Now on Omarchy: read the manual without leaving your desktop
All practice

SQL Practice

Hands-on SQL lessons - write real queries against a live in-browser database and get checked instantly.

Basic 0/26 complete

SQL Practice

Twenty-six short, hands-on SQL lessons, from a single SELECT all the way past joins into subqueries, window functions, transactions, many-to-many joins, CTEs, CASE, UNION, ALTER TABLE, and self-joins. Each lesson gives you a task, a live database, and a Run button - you write the query, run it, and get checked instantly. Everything runs in your browser.

The last six are the ones that matter at work, where the query runs, returns a result, and is still wrong: a single NULL that empties a NOT IN, a join that quietly doubles your revenue, a status column everyone forgets, a typo that splits one company into three, and two capstones where the hard part is pinning down what the question actually means.

Start with lesson 1. You can leave and come back any time - your code is saved locally.

Lessons

26 total
  1. 01 Select specific columns
  2. 02 Filter rows with WHERE
  3. 03 Sort and limit results
  4. 04 Count and summarize
  5. 05 Group rows together
  6. 06 Filter groups with HAVING
  7. 07 Combine tables with JOIN
  8. 08 Capstone: total spent per customer
  9. 09 Subqueries: a query inside a query
  10. 10 Rank rows with a window function
  11. 11 Messy data: NULLs and duplicate names
  12. 12 Transactions: all or nothing
  13. 13 Capstone: rank customers, gaps included
  14. 14 Many-to-many: joining through a junction table
  15. 15 CTEs: naming a subquery with WITH
  16. 16 CASE: bucket rows into categories
  17. 17 UNION: combining two result sets
  18. 18 ALTER TABLE: changing a table's shape
  19. 19 Self-join: a table joined to itself
  20. 20 Fix the bug: rows go missing, no error
  21. 21 Fix the bug: NOT IN quietly returns nothing
  22. 22 Fix the bug: a JOIN that doubles your revenue
  23. 23 The status column everyone forgets
  24. 24 One typo splits a group into three
  25. 25 Capstone: define "top customer" before you query it
  26. 26 Capstone: who has churned