Menu▾

SQL for Data Science

Somebody hands you a dataset

Now what? That is the part nobody teaches. You know how to write a SELECT; what you do not know yet is which question you were actually asked, what to check before you trust a column, what to fix and what to leave, and what a finished answer looks like. This track walks the whole thing, start to finish, on tables small enough to check by counting.

Nothing here goes past chapter 18 of the free tutorial — no subqueries, no CTEs, no window functions, one flat query at a time. That is a promise the build enforces, not a style note. Learning SQL itself, and Database Fundamentals, stay free forever. This track is included with Basic, and the first chapter is open to everyone.

Sign in to track your progress across chapters.

Phase 1 Look at it

3 chapters

Before any of it means anything: what you were actually asked, what is in front of you, and what one row of it stands for.

  1. 01You have a dataset. Now what?7 minFreeThe whole job end to end on twelve rows: look at it, check it, clean it, answer the question. Every later chapter zooms into one of these six queries.
  2. 02What is the question, really?7 min"Is the promo working?" is not a question SQL can answer. Turning it into a metric with a numerator, a denominator, a population and a period — and watching two honest readings disagree.
  3. 03First look at a table7 minFive queries you run on any table you have never seen before — and the one they exist to answer: what does a single row of this thing actually stand for?

Phase 2 Clean it

4 chapters

Counting things correctly, missing values that are not zeroes, one thing spelled four ways, and deciding which duplicate survives.

  1. 04Counting things correctly7 minFourteen rows, one question, five honest answers. What COUNT(*), COUNT(col) and COUNT(DISTINCT col) each actually count — and the denominator AVG picks without telling you.
  2. 05Missing is not zero7 minBlank, zero and unknown are three different facts about the world. What each does to a total, an average and a filter — and when COALESCE is a fix rather than a lie.
  3. 06The same thing spelled four ways8 minThree cities arrive as nine spellings. Enumerate the variants first, fix the mechanical half with functions, map the rest by hand — and stop at coverage, not perfection.
  4. 07Duplicates, and which one you keep8 minTwelve rows, eight customers. Finding the repeats with GROUP BY and HAVING, deciding which row survives, and seeing exactly what the duplicates did to the average before you noticed them.

Phase 3 Work with it

2 chapters

Grouping the rows into the buckets the question needs, and bringing in the second table without quietly doubling your total.

  1. 08Putting things in buckets7 minTwelve balances into small, medium and large. Where the boundary goes, who falls through the gap between bands, and why moving one boundary moves every number downstream.
  2. 09Bringing in the other table8 minThe one join chapter. Eight orders worth RM 655.50 become RM 540.50 the moment you add customer names — and the row count does not change to warn you.

Phase 4 Deliver it

1 chapter

A table someone can act on: rounded, labelled, with the exclusions and the caveat written down rather than remembered.

  1. 10Deliver a number someone can use8 minOne row per thing asked about, rounded, labelled, with the population and the exclusions written into the output — and the average that hides the one ticket that took five hours.

When you want to go deeper

There is a second, harder track: 19 chapters on grain, reshaping, change over time, and whether a change really worked. It leans on subqueries, CTEs and window functions, so it assumes all of the free tutorial and this track first. It is the level-up, not the next step — finish here before you look at it.

See the advanced track →

Included with Basic

Chapter 1 is open in full, and the first section of every other chapter is too — read before you decide. Basic opens the rest of both tracks, the full question bank, and Data Lab, where the same work happens on a warehouse too big to eyeball.

See Basic plans