~/learn/sql
SQL curriculum
Joins, aggregation, window functions on a live SQLite database.
SELECT → filter → group → join → rank
0 / 18 lessons completed
Milestone 1 · Foundations
BeginnerStart here — the syntax and mental models everything else builds on.
- 1
Query basics
~5 min · 1 lessonPull exactly the columns you need out of any table.
SELECTFROMASDISTINCT - 2
Filtering & sorting
~14 min · 2 lessonsFind the rows that matter — e.g. UK customers who signed up this year, newest first.
WHEREORDER BYLIMITIS NULL - 3
Aggregation
~8 min · 1 lessonAnswer business questions like total sales per country or average order value.
COUNTSUMAVGGROUP BYHAVING
Milestone 2 · Real-world data
IntermediateCombine data from several places and reshape it into answers.
- 1
Joins
~15 min · 2 lessonsCombine customers, orders and products into one answer.
JOINLEFT JOINUNIONself join - 2
Subqueries & CTEs
~18 min · 2 lessonsBreak a hard question into small named steps.
IN (…)EXISTSWITHRECURSIVE - 3
Dates & text
~25 min · 3 lessonsGroup sales by month, clean up names and label rows with rules.
strftimeSUBSTRLOWERCASE WHEN
Milestone 3 · Interview-ready
AdvancedThe techniques that show up in real interviews and real pipelines.
- 1
Window functions
~22 min · 2 lessonsRank products, compute running totals and compare to the previous row.
OVERPARTITION BYRANKLAG - 2
Analytics patterns
~31 min · 3 lessonsBuild the retention, growth and top-N reports analysts ship weekly.
cohortsMoM growthtop-N - 3
Query performance
~17 min · 2 lessonsExplain why a query is slow and make it fast.
INDEXEXPLAINrewrites