SQL Editor: Query Your Data with SQL
A beginner-friendly guide to SQL: what it is, how to use the SQL Editor, write your first query, and export results.
SQL Editor: Query Your Data with SQL
This guide introduces SQL in plain English and shows you how to use the SQL Editor to query your databases. No prior experience required.
What Is SQL? (Plain English)
SQL (Structured Query Language) is a language used to talk to databases. Think of it as a way to ask questions and give instructions:
- "Show me all customers from New York"
- "Count how many orders we had last month"
- "Give me the average sale amount by product"
Basic Idea
- Data lives in tables (like spreadsheets)
- Each table has columns (e.g., name, age, city)
- Each row is one record (e.g., one person or one order)
- SQL lets you SELECT (choose) columns and filter rows with conditions
The SQL Editor Interface
- Go to Connections or Data Management in the sidebar
- Open SQL Editor or Query Editor
- You will see:
Schema Browser
The schema browser helps you explore your data:
| Item | What It Shows |
|---|---|
| Database | Top-level database or schema |
| Table | A table (e.g., customers, orders) |
| Column | Column name and data type (number, text, date) |
Your First Query: SELECT, FROM, WHERE
The Simplest Query
sqlCopy0 1 customers;
- SELECT — "Give me these columns" (
means "all columns") - FROM — "From this table"
- customers — The table name
- ; — End of the statement (like a period at the end of a sentence)
customers table.
Choose Specific Columns
sqlCopy0 name, email, city 1 customers;
This returns only the name, email, and city columns.
Filter Rows with WHERE
sqlCopy0 name, email, city 1 customers 2 city = 'New York';
- WHERE — "Only rows that match this condition"
city = 'New York'— Only customers whose city is "New York"
') for text values. Numbers do not need quotes.
More WHERE Examples
| Goal | SQL |
|---|---|
| Numbers greater than 100 | WHERE amount > 100 |
| Dates after 2024 | WHERE orderdate >= '2024-01-01' |
| Text contains "John" | WHERE name LIKE '%John%' |
| Multiple conditions (AND) | WHERE city = 'NYC' AND amount > 50 |
| Either condition (OR) | WHERE status = 'active' OR status = 'pending' |
Common SQL Patterns for Analytics
COUNT — How Many Rows?
sqlCopy0 1() 2 orders;
Returns the total number of rows in orders.
sqlCopy0 1() 2 orders 3 status = 'completed';
Returns how many orders have status "completed".
AVG, SUM, MIN, MAX — Aggregate Numbers
sqlCopy0 1(amount) 2 averagesale, 3(amount) 4 totalrevenue, 5(amount) 6 smallestorder, 7(amount) 8 largestorder 9 orders;
- AVG — Average
- SUM — Total
- MIN / MAX — Smallest / largest value
- AS — Gives the result column a friendly name
GROUP BY — Summarize by Category
sqlCopy0 city, 1() 2 customercount, 3(age) 4 avgage 5 customers 6 7 city;
Returns one row per city with the count of customers and average age per city.
sqlCopy0 productname, 1(quantity) 2 totalsold 3 sales 4 5 productname 6 7 totalsold DESC;
Shows total quantity sold per product, sorted from highest to lowest.
ORDER BY — Sort Results
sqlCopy0 name, amount 1 orders 2 3 amount DESC;
- ORDER BY — Sort the results
- DESC — Descending (highest first). Use ASC for ascending (lowest first)
JOIN — Combine Two Tables
When data is split across tables (e.g., orders and customers), use JOIN:
sqlCopy0 orders.id, orders.amount, customers.name 1 orders 2 customers 3 orders.customerid = customers.id;
- JOIN — Combine rows from two tables
- ON — Match rows where
orders.customeridequalscustomers.id
Running Queries
- Type or paste your SQL in the query area
- Click Run or press
Ctrl+Enter(orCmd+Enteron Mac) - Results appear in the results panel below
- Scroll to see all rows; the platform may limit display (e.g., first 1,000 rows)
Query History
- The SQL Editor keeps a history of recent queries
- Open the history panel to see past queries
- Click a past query to load it and run it again
Saved Queries
- Click Save to store a query with a name
- Find saved queries in the Saved or Favorites section
- Edit and re-run them anytime
- Share with teammates if the platform supports it
Exporting Results
- Run your query
- Click Export or Download
- Choose format:
- Save the file to your computer
Tips for Beginners
SELECT FROM yourtable to see all data, then add WHERE and column names to narrow down.WHERE, then add GROUP BY and aggregates.-- to test smaller pieces:sqlCopy> 0
> 1 2() 3 orders;
>
Quick Reference
| Task | How |
|---|---|
| Run query | Click Run or Ctrl+Enter |
| See tables | Use schema browser |
| Filter rows | WHERE column = value |
| Count rows | SELECT COUNT() FROM table |
| Group by column | GROUP BY column |
| Sort results | ORDER BY column DESC |
| Export results | Run query > Export > CSV or Excel |
What's Next?
- [Database Connections Guide](database-connections-guide) — Set up connections to MySQL, PostgreSQL, and more
- [Datasets Guide](datasets-guide) — Upload and manage file-based datasets
Related Articles
Database Connections: Connect to MySQL, PostgreSQL, and More
Learn how to connect DevShareHub Analytics to 12 supported databases including MySQL, PostgreSQL, MongoDB, and SQL Server.
Datasets Guide: Upload, Preview, and Manage Your Data
A comprehensive guide to uploading CSV, Excel, and JSON files, configuring delimiters and encoding, previewing your data, and managing your datasets.
Was this helpful?