SQL for Data Science
The query is the easy part
Nobody is going to ask you to write a JOIN. They are going to hand you a table where the same city is spelled four ways, half the ratings are missing, one customer exists twice, and ask whether the number went up. Every chapter here is one of those decisions — not which function to type, but which answer you are prepared to defend.
Learning SQL itself stays free, forever — the 29-chapter tutorial and Database Fundamentals are the prerequisite for this track and neither is going behind a paywall. This one is included with Basic.
Sign in to track your progress across chapters.
Phase 1 Dirty data
6 chaptersThe table is wrong before you touch it. Which number to trust, which duplicate to keep, and what you are allowed to throw away.
- 01The aggregate that lies9 minEight rides, one question, four different answers — all of them produced by correct SQL. Learning which one you actually meant.
- 02Which duplicate survives11 minDeduplication is not a technique, it is a choice about who to keep — and every choice breaks a different downstream number.
- 03One city, four spellings10 minFree-text columns are a list of everything anyone ever typed. Enumerate it first, normalise what is mechanical, and put the rest somewhere a human can review.
- 04Pick the grain before you query11 minOne row per what? Declare the answer before you write the join, then prove the join kept it. Almost every inflated total is a grain that changed and nobody noticed.
- 05What you exclude, and why12 minCancelled orders, test accounts, one enormous outlier. Every number you report is a number after exclusions — the job is choosing them deliberately and writing them down where the number lives.
- 06The check you run before you trust a table12 minSix questions, always the same six, run before you know what the analysis is. Row count, null rate, key, duplicates, orphans, cardinality — and what each answer should make you do next.
Phase 2 Reshape it
in progressTurning rows you were given into the table the question actually needs — the shape, the buckets, the columns nobody wrote down.
Being written. Chapters land here as they are finished.
Phase 3 Change over time
in progressPeriods that lie, windows that smooth away the story, cohorts, streaks, and the population that quietly selected itself.
Being written. Chapters land here as they are finished.
Phase 4 Measure and test
in progressSomebody shipped a change and wants to know if it worked. Reading the result, checking it was a fair test, and the four ways it fools you.
Being written. Chapters land here as they are finished.
Included with Basic
The first section of every chapter is open — read one before you decide. Basic opens the rest of this track, the full question bank, and Data Lab, where the same work happens on a warehouse too big to eyeball.
See Basic plans