Skip to main content

Get Up and Running

This guide will take you from zero to querying your database in under 5 minutes.
Make sure you’ve installed Queryly before proceeding.

Your First Database Connection

1

Add a connection

Start by adding your first database connection:
queryly connect add
You’ll be prompted to enter:
  • Connection name: A friendly name (e.g., “LocalDB”, “MyApp”)
  • Database type: Choose from SQLite, SQL Server, PostgreSQL, or MySQL
  • Connection string: The connection string for your database
Example for SQLite:
Connection name: LocalDB
Database type: SQLite
Connection string: Data Source=myapp.db
The connection will be tested before saving to ensure it works correctly.
For SQLite, you can use relative paths like ./mydb.db or absolute paths like /home/user/databases/app.db
2

List your connections

Verify that your connection was saved:
queryly connect list
You’ll see a table showing all saved connections with their type and last used date:
┌──────────────┬──────────────┬─────────────────────┐
│ Name         │ Type         │ Last Used           │
├──────────────┼──────────────┼─────────────────────┤
│ LocalDB      │ SQLite       │ 2025-12-13 10:30:00 │
└──────────────┴──────────────┴─────────────────────┘
3

Test the connection

Test that the connection works:
queryly connect test LocalDB
You should see a success message confirming the connection is working.

Explore Your Database Schema

Now that you have a connection, let’s explore what’s in your database.
1

List all tables

See all tables in your database:
queryly schema list LocalDB
Output example:
┌──────────────┬──────────┬─────────────┐
│ Table Name   │ Rows     │ Size        │
├──────────────┼──────────┼─────────────┤
│ users        │ 1,234    │ 2.5 MB      │
│ products     │ 567      │ 1.2 MB      │
│ orders       │ 8,901    │ 5.7 MB      │
└──────────────┴──────────┴─────────────┘
2

View table structure

Get detailed information about a specific table:
queryly schema info LocalDB users
This shows columns, data types, constraints, and indexes:
Table: users

Columns:
┌──────────────┬──────────────┬──────────┬─────────┐
│ Column       │ Type         │ Nullable │ Key     │
├──────────────┼──────────────┼──────────┼─────────┤
│ id           │ INTEGER      │ NO       │ PRIMARY │
│ name         │ TEXT         │ YES      │         │
│ email        │ TEXT         │ YES      │         │
│ created_at   │ DATETIME     │ YES      │         │
└──────────────┴──────────────┴──────────┴─────────┘
3

View schema as a tree

Get a visual overview of your entire database schema:
queryly schema tree LocalDB
Output:
LocalDB (SQLite)
├── users
│   ├── id (INTEGER, PRIMARY KEY)
│   ├── name (TEXT)
│   └── email (TEXT)
├── products
│   ├── id (INTEGER, PRIMARY KEY)
│   ├── name (TEXT)
│   └── price (REAL)
└── orders
    ├── id (INTEGER, PRIMARY KEY)
    ├── user_id (INTEGER)
    └── product_id (INTEGER)

Browse and Query Data

Now let’s look at actual data in your tables.
1

Browse table data

View the first 50 rows of a table:
queryly data browse LocalDB users
You’ll see a formatted table with your data:
┌────┬──────────────┬──────────────────────┬─────────────────────┐
│ id │ name         │ email                │ created_at          │
├────┼──────────────┼──────────────────────┼─────────────────────┤
│ 1  │ Alice Smith  │ [email protected]    │ 2025-01-15 10:30:00 │
│ 2  │ Bob Jones    │ [email protected]      │ 2025-01-16 14:22:00 │
│ 3  │ Carol Lee    │ [email protected]    │ 2025-01-17 09:15:00 │
└────┴──────────────┴──────────────────────┴─────────────────────┘
Showing 3 of 1,234 rows
2

Run custom queries

Enter interactive query mode to run custom SQL:
queryly data query LocalDB
This opens an interactive SQL prompt:
Query Mode - LocalDB
Enter SQL queries. Type 'exit' to quit.

SQL> SELECT * FROM users WHERE name LIKE 'A%'
┌────┬──────────────┬──────────────────────┐
│ id │ name         │ email                │
├────┼──────────────┼──────────────────────┤
│ 1  │ Alice Smith  │ [email protected]
│ 5  │ Andrew Kim   │ [email protected]
└────┴──────────────┴──────────────────────┘
Showing 2 of 2 row(s) | Query time: 1.23ms

SQL> SELECT COUNT(*) FROM users
┌────────────┐
│ COUNT(*)   │
├────────────┤
│ 1234       │
└────────────┘
Showing 1 of 1 row(s) | Query time: 0.45ms

SQL> exit
Exited query mode.
Query mode supports all SQL statements your database supports. Type exit or press Ctrl+C to quit.
3

Export data

Export table data to CSV or JSON:
# Export to CSV
queryly data export LocalDB users csv

# Export to JSON
queryly data export LocalDB users json
The exported file will be saved in your current directory with a timestamp:
✓ Exported 1,234 rows to users_20250113_103045.csv

Connection String Examples

Here are example connection strings for each supported database:
Data Source=./myapp.db
Data Source=/home/user/databases/app.db
Data Source=:memory:
Data Source=mydb.db;Mode=ReadOnly

Complete Example Workflow

Here’s a complete example of working with a SQLite database:
# Add a connection
queryly connect add
# name: MyApp
# type: SQLite  
# connection string: Data Source=myapp.db

# List all tables
queryly schema list MyApp

# View structure of 'users' table
queryly schema info MyApp users

# Browse user data
queryly data browse MyApp users

# Run custom queries
queryly data query MyApp
SQL> SELECT * FROM users WHERE email LIKE '%@example.com'
SQL> exit

# Export to CSV
queryly data export MyApp users csv

Common Tasks

Manage Connections

# List connections
queryly connect list

# Test connection
queryly connect test MyDB

# Remove connection
queryly connect remove MyDB

Explore Schema

# List tables
queryly schema list MyDB

# Table details
queryly schema info MyDB users

# Schema tree
queryly schema tree MyDB

Browse Data

# View table data
queryly data browse MyDB users

# Interactive queries
queryly data query MyDB

Export Data

# Export to CSV
queryly data export MyDB users csv

# Export to JSON
queryly data export MyDB users json

Next Steps

Now that you’re familiar with the basics, explore more:

Command Reference

Complete list of all Queryly commands and options

Database Providers

Learn about connection strings for each database type

Configuration

Configure Queryly settings and connection management

Troubleshooting

Solutions to common issues and error messages

Build docs developers (and LLMs) love