Free SQL course

Learn SQL for interview practice.

Forty short lessons, from your first SELECT to window functions and analytical patterns for interview preparation. You write the queries, every answer is checked, and each module ends on three interview problems. Nothing to install.

Free with an account — checked exercises and completed lessons sync to it. No card, no trial.

The syllabus

Eight modules, about ten hours in total. Take them in order or jump straight to the one you need — all available lessons are open with a free account.

1Reading a table4 lessonsSELECT, WHERE, ORDER BY, LIMIT and DISTINCT — getting exactly the rows and columns you mean, and sizing up a table you have never seen.31 min
  1. What a table is
  2. SELECT and WHERE
  3. ORDER BY and LIMIT
  4. DISTINCT and sizing up a table
2Aggregation5 lessonsCOUNT, SUM, AVG, MIN and MAX; GROUP BY and HAVING; percentages and ratios, and the integer division that makes a percentage query return 0.45 min
  1. Counting and summing
  2. GROUP BY
  3. Grouping by more than one column
  4. HAVING
  5. Percentages and ratios
3Joins and grain6 lessonsInner, left, right and full outer joins; keys and grain; fan-out and double counting; anti-joins, semi-joins and self-joins.1 h
  1. Inner join
  2. Left join
  3. Right and full outer joins
  4. Grain and fan-out
  5. Anti-joins and semi-joins
  6. Self-joins
4NULLs, dedup and conditional logic5 lessonsHow NULL behaves in comparisons and aggregates; COALESCE and NULLIF; the NOT IN trap; CASE and conditional aggregation; removing duplicates.45 min
  1. What NULL is
  2. NULL in aggregates and arithmetic
  3. The NOT IN trap
  4. CASE and conditional aggregation
  5. Duplicates
5Dates and time4 lessonsHalf-open ranges and the BETWEEN trap; DATE_TRUNC, EXTRACT and date arithmetic; bucketing by day, week and month; gaps between events.35 min
  1. Dates, timestamps and ranges
  2. DATE_TRUNC and bucketing
  3. Date arithmetic
  4. Time between events
6CTEs and subqueries4 lessonsSubqueries in WHERE, FROM and SELECT; CTEs; and how to split a hard question into steps.35 min
  1. Subqueries in WHERE
  2. Subqueries in FROM and SELECT
  3. CTEs
  4. Splitting a hard question into steps
7Window functions6 lessonsPartitions, ranking and ties, LAG and LEAD, running totals and rolling seven-day windows.49 min
  1. What a window is
  2. PARTITION BY and ORDER BY
  3. Ranking and ties
  4. LAG and LEAD
  5. Running totals
  6. Rolling windows
8Interview patterns6 lessonsTop-N per group, retention and cohorts, funnels, streaks and gaps, set operations and string clean-up — plus timed drills you write without running, the way live screens work.1 h 5 min
  1. Top-N per group
  2. Retention and cohorts
  3. Funnels
  4. Streaks and gaps
  5. UNION, set operations and strings
  6. Timed drills

How a lesson works

Short lessons, real queries

A few paragraphs, then you write SQL against realistic tables and see the result immediately.

Every answer is checked

Exercises compare your result to the expected one. When it’s wrong you see the exact mismatch, and for the classic mistakes, what went wrong and how to fix it.

Finish on interview problems

Each module ends with three problems. Most come from our bank of 188 SQL practice questions organized by Meta, Google, Amazon and 20 other companies; where the bank has nothing a module can close on, we wrote our own. Solve them here and they count on your dashboard.

40 lessons · 8 modules · 24 interview problems · free

Start at lesson one. Keep everything you learn.

Create your free account

Google sign-in only — no passwords to manage.