SQL: ask questions of data

The language behind almost every app. Query a real SQLite database in your browser, from SELECT to joins, grouping and window functions.

Beginner to expert · 12 lessons · about 109 minutes

Start the track
  1. Your first query BeginnerAsk a database for data with SELECT and FROM.5 min
  2. Filtering with WHERE BeginnerKeep only the rows you want with WHERE, AND and OR.7 min
  3. Sorting and limiting BeginnerPut results in order with ORDER BY and take the top few with LIMIT.6 min
  4. Counting and totals BeginnerSummarise a whole table with COUNT, SUM, AVG, MIN and MAX.7 min
  5. Grouping with GROUP BY and HAVING IntermediateGet one summary row per group, and filter the groups themselves.9 min
  6. Joining tables IntermediateCombine rows from several tables with JOIN, following the ids that link them.10 min
  7. Joins with totals IntermediateJoin tables and summarise the result to answer real business questions.10 min
  8. LEFT JOIN and missing data IntermediateKeep rows that have no match, and find what is missing using NULL.9 min
  9. Subqueries IntermediateUse the result of one query inside another.9 min
  10. Changing data IntermediateAdd, change and remove rows with INSERT, UPDATE and DELETE.10 min
  11. Designing tables AdvancedCreate your own tables with column types, keys and constraints that protect your data.12 min
  12. CTEs and window functions ExpertBreak big queries into named steps with WITH, and rank and run totals with window functions.15 min
Track project · Reviewed by a mentor · PremiumProject: The shop's sales reportBuild a reusable sales report for the shop, with views, monthly totals and a city-by-city breakdown.