Free SQL Practice Playground & Online SQL Editor

Practice SQL queries in your browser. Build JOIN, GROUP BY and HAVING queries with dropdowns, write your own SQL in a code editor, and run it on a real SQLite database. No signup, no install.

Query history

Run a query to see results here.

Read the data

SELECT picks columns, FROM picks the table, WHERE keeps only matching rows.

SELECT name, salary
FROM employees
WHERE salary > 50000;

Summarise it

COUNT, SUM and AVG turn many rows into one value. GROUP BY makes the groups, HAVING filters them.

SELECT dept_id, COUNT(*) AS people
FROM employees
GROUP BY dept_id
HAVING COUNT(*) > 1;

Add logic

CASE WHEN is if / else inside a query. COALESCE fills in a value when something is NULL.

SELECT name,
  CASE
    WHEN salary >= 50000 THEN 'High'
    ELSE 'Low'
  END AS band
FROM employees;

What is a SQL practice playground and online query editor?

SQL (Structured Query Language) is the standard language for reading and changing data in databases such as MySQL, PostgreSQL, SQL Server and SQLite. Practising it normally means installing a database first.

This free tool runs a real SQLite database inside your browser tab. Create dummy tables, build a query with dropdowns or write it in a code editor, and see the result instantly. Nothing to install, and nothing you type is uploaded.

Visual builder

Pick a JOIN type and columns. The SQL is written for you.

SQL editor

Highlighting, autocomplete, format and history.

Cheat sheet

27 runnable examples, from INSERT to window functions.

Your choices in the builder
Join type : INNER
Left      : employees.dept_id
Right     : departments.id
WHERE     : salary > 50000
↓ Generated SQL ↓
SQL
SELECT *
FROM employees
INNER JOIN departments
  ON employees.dept_id = departments.id
WHERE salary > 50000;

SQL query structure: how a query is built

Every query is a few clauses in a fixed order. Learn the order once and most queries become easy to read.

ClauseWhat it doesExample
SELECTChoose the columns you want to seeSELECT name, salary
FROMChoose the table to read fromFROM employees
JOIN … ONCombine rows from another table where columns matchJOIN departments ON employees.dept_id = departments.id
WHEREKeep only the rows that match a conditionWHERE salary > 50000
GROUP BYMake one row per group so you can total itGROUP BY dept_id
HAVINGKeep only the groups that match (WHERE works on rows, HAVING on groups)HAVING COUNT(*) > 1
ORDER BYSort the resultORDER BY salary DESC
LIMITStop after a number of rowsLIMIT 5

You write SELECT first, but SQL reads the query in this order: FROM → JOIN → WHERE → GROUP BY → HAVING → SELECT → ORDER BY → LIMIT. That is why a column alias created in SELECT cannot be used in WHERE.

Common SQL functions with examples

The functions you will use almost every day. Try any of them in the editor or open them from the Examples tab.

FunctionIn one lineExample
COUNT(*)Counts rowsCOUNT(*)
SUM(x) / AVG(x)Total or average of a columnAVG(salary)
MIN(x) / MAX(x)Smallest or largest valueMAX(salary)
ROUND(x, n)Rounds a number to n decimalsROUND(salary / 12.0, 2)
UPPER(x) / LOWER(x)Changes the case of textUPPER(name)
LENGTH(x)Number of characters in textLENGTH(name)
SUBSTR(x, start, len)Cuts part of a textSUBSTR(name, 1, 3)
x || yJoins text togethername || ' - ' || city
COALESCE(x, y)Uses y when x is NULLCOALESCE(dept_id, 0)
CASE WHEN … THEN … ENDIf / else logic inside a queryCASE WHEN salary > 50000 THEN 'High' ELSE 'Low' END
DATE('now')Today’s date, with date mathDATE('now', '+7 days')
ROW_NUMBER() OVER (…)Numbers rows inside each groupROW_NUMBER() OVER (PARTITION BY dept_id ORDER BY salary DESC)

SQL editor features, explained

What each panel and button does, and how to use it.

Visual JOIN builder

Builds JOIN, WHERE, GROUP BY, HAVING, ORDER BY and LIMIT queries from dropdowns.

HowChoose the join type, both tables and the matching columns. The SQL updates as you click. Press Run query to see the result and a plain-English note on what the JOIN did.

SQL editor with highlighting

Colours keywords, functions, strings and comments, with line numbers.

HowOpen the SQL editor tab and type. Brackets and quotes close themselves and Enter keeps your indent.

Autocomplete

Suggests keywords, functions, table names and column names as you type.

HowStart typing and press Tab to accept the first suggestion, or click one. Type employees. to see only that table’s columns.

Run, selection and history

Runs the whole editor or only the text you select. Keeps your last 15 queries.

HowPress Ctrl+Enter. Select part of the SQL first to run just that part. Open Query history to reuse a query.

Friendly errors

Explains mistakes in plain English and suggests the name you probably meant.

HowA typo such as nme gives: Column “nme” was not found. Did you mean “name”?

Format SQL and snippets

Tidies a query with uppercase keywords and one clause per line. Snippets insert ready templates.

HowClick Format SQL, or use Insert snippet for SELECT, JOIN, GROUP BY + HAVING, CASE WHEN, INSERT, UPDATE, DELETE and WITH.

Results and query plan

Shows rows with numbers, orange NULLs, row count and run time. The plan shows how SQLite finds the rows.

HowUse the Output panel below the editor. Copy CSV, CSV and JSON export the result. Query plan explains SCAN and SEARCH.

Tables panel

Load sample data, create tables, import a CSV or export everything as a SQL script.

HowClick a column to insert it into the editor. Use ▶ to preview rows and ✕ to drop a table. Reset restores a clean database.

How to use the SQL practice playground

Five steps from an empty database to a result you understand.

  1. 01

    Add tables

    Load a sample dataset, create a table, or import your own CSV. The Tables panel lists each table with its columns.

  2. 02

    Build or write a query

    Use the Visual JOIN builder, or open the SQL editor and write your own. Open any example from the Examples tab.

  3. 03

    Run it

    Press Run, or Ctrl+Enter in the editor. Nothing runs until you do, so you can read and edit first.

  4. 04

    Read the output

    Check the rows, the row count and the run time. Open Query plan to see how the database found the rows.

  5. 05

    Export or practise more

    Copy or download the result as CSV or JSON, export the database as SQL, or Reset and try again.

Common workflows

Learn how JOINs work

Compare INNER, LEFT, RIGHT and FULL

  1. Load the Employees + Departments sample.
  2. Choose INNER in the builder and run it.
  3. Change to LEFT and run again.
  4. Compare the row counts and the NULL cells.

Practise INSERT, UPDATE, DELETE

Change data safely

  1. Open Examples and click Try it on INSERT.
  2. Press Run in the editor.
  3. Repeat for UPDATE and DELETE.
  4. Click Reset to restore the sample data.

Find groups with HAVING

Totals that pass a test

  1. Open the HAVING example.
  2. Change 50000 to another number.
  3. Run it and read the output.
  4. Add ORDER BY to sort the groups.

SQL JOIN types and when to use them

JOINKeepsUse it when
INNEROnly rows that match in both tablesYou want employees that have a department
LEFTAll left rows, matching right rows or NULLYou want every employee, even without a department
RIGHTAll right rows, matching left rows or NULLYou want every department, even empty ones
FULL OUTERAll rows from both tablesYou want to find rows missing on either side
CROSSEvery left row paired with every right rowYou need all combinations

Everything runs in your browser on SQLite (sql.js). Nothing you type is uploaded.

SQL editor keyboard shortcuts

Small time-savers while you write SQL.

ShortcutWhat it does
Ctrl/⌘ + EnterRun the editor, or only the selected text
TabAccept the first autocomplete suggestion, or insert two spaces
Esc, then TabLeave the editor with the keyboard (accessibility)
Ctrl/⌘ + /Comment or uncomment the selected lines
EnterNew line that keeps the current indent
Double-click a table nameInsert the table name into the editor

Frequently asked questions

Quick answers about the SQL practice playground and editor.

What is a SQL practice playground?

A place to write and run SQL without installing a database. This one runs SQLite in your browser, so you can create tables, run queries and see results straight away.

Which SQL dialect does it use?

SQLite. Standard SQL such as SELECT, JOIN, GROUP BY, HAVING, CASE, subqueries, CTEs and window functions works the same as in MySQL or PostgreSQL. A few functions differ, for example dates.

Is my data saved or uploaded?

No. The database lives in memory in your browser tab and is cleared when you refresh. Only your recent query history is kept in your browser. Use Export SQL to keep a copy of your tables.

Can I practise INSERT, UPDATE and DELETE safely?

Yes. You are working on a practice database in your own browser, so nothing real can be damaged. Click Reset to get the sample data back.

What is the difference between WHERE and HAVING?

WHERE filters rows before they are grouped. HAVING filters the groups after GROUP BY, so it can use totals such as COUNT(*) or AVG(salary).

Why does RIGHT or FULL JOIN show an error?

They need a recent SQLite build. If your browser build is older, swap the two tables and use a LEFT JOIN, which gives the same result.

Need data to practice with?

Generate fake rows, then paste the SQL INSERTs into the editor.