SQL Query Lab

Free SQL practice, checked as you run it

Guides
Your last query is back
Changed
Getting the practice databases ready…

74 SQL practice questions

Pick one and it opens in the editor above. Your progress is saved in this browser.

SELECT 36 questions

Filters, joins, grouping, CTEs and window functions.

INSERT 8 questions

Add rows, copy rows and upsert.

UPDATE 9 questions

Change the right rows, and only those.

DELETE 8 questions

Remove rows by date, by status and by what they relate to.

DDL 13 questions

Create, change and drop tables, indexes and views.

How each question works

  1. Read the question

    The tables it needs are open beside it, with every column and type. Click a column to add it to your query.

  2. Run your query

    It runs on a real SQLite database inside your browser. There is nothing to install, and your queries are not sent to a server.

  3. See what differs

    Your rows are compared with the answer cell by cell. If it isn't right yet, you see the first row and column that differ.

Three small databases

Want to try your own SQL on them? Open the sandbox. Change anything you like and reset the data whenever you want.

SQL guides

Good to know

Is it free?

Yes. All 74 questions, the sandbox and the guides are free, and there is no account to create.

What can I practice?

SELECT, JOINs, GROUP BY, HAVING, subqueries, CTEs and window functions, then INSERT, UPDATE, DELETE and DDL such as CREATE, ALTER and DROP.

Do I need to install a database?

No. SQLite runs in your browser as WebAssembly (sql.js), so your queries run on your own machine.

Which SQL dialect is it?

SQLite. If you need Microsoft SQL Server, translate your query to T-SQL and compare the two.

Is my progress saved?

Yes, in this browser. It isn't shared between devices, and clearing your browser data removes it.