Lessons
The concepts behind the problems, five minutes each. Read one, then practise it on a real pipeline.
SQL foundations
BeginnerGROUP BY and aggregationGROUP BY sorts rows into buckets that share the same values, then an aggregate function (count, sum, avg, min, max) turns each bucket into a single row. Every column you select must either define the bucket or be aggregated over it.6 problems to practiseBeginnerJoins and fan-outA join puts rows from two tables side by side wherever their keys match. If a key appears more than once on one side, every match produces a row, so rows multiply and any total you compute afterwards grows with them.5 problems to practiseBeginnerConditional aggregation and CASEConditional aggregation computes several numbers over the same group in one pass: each aggregate only looks at the rows that meet its own condition. It's how you count paid and refunded orders side by side, compute a rate, or turn rows into columns (a pivot).6 problems to practiseJuniorEXISTS and NOT EXISTSEXISTS keeps a row when at least one matching row exists somewhere else; NOT EXISTS keeps it when none does. Unlike a join, they never multiply rows and never bring columns along: they only answer yes or no for each row.5 problems to practise
Windows & time series
JuniorWindow functionsA window function computes something over a group of related rows (a rank, a running total, the previous value) but, unlike GROUP BY, it keeps every row. You say which rows belong together with PARTITION BY and in what order with ORDER BY.6 problems to practiseIntermediateDate spinesData only has rows for days when something happened, so a day with no sales simply doesn't exist in the result. A date spine is a list of every day you report on; you join your data onto it, and the empty days show up as 0 instead of disappearing.4 problems to practiseIntermediateGaps and islandsAn island is a run of consecutive rows (days in a row, clicks close together) and a gap is where the run breaks. The trick is to give every row in the same run the same group id, and then a plain GROUP BY measures each run.4 problems to practiseAdvancedRange joins and as-of joinsAn as-of join attaches to each event the value that was true at that moment: the price when the order was placed, the exchange rate on the day of the payment, the customer's plan when they churned. It joins on a time range instead of an equal key, and it's what keeps reports and ML features from using information that didn't exist yet.3 problems to practise
Incremental pipelines
IntermediateIdempotent loads and MERGEA load is idempotent when running it twice leaves the same table as running it once. Jobs get retried, re-run after a fix and backfilled, so a pipeline that isn't idempotent eventually doubles your numbers.6 problems to practiseAdvancedChange data captureEvery database keeps a log of each insert, update and delete it commits, in order. Change data capture (CDC) reads that log and replays it somewhere else, so the copy can catch up without re-reading whole tables, and deletes are carried over too.2 problems to practiseAdvancedLate data and event timeEvery event has two times: when it happened (event time) and when your pipeline received it (processing time). A phone offline for an hour, a retry, a slow partner: events arrive late, and a daily total computed once, right after midnight, stays wrong forever unless the pipeline goes back and recomputes the days late events belong to.5 problems to practise
Data quality
BeginnerNULLs and missing valuesNULL means "we don't know", not zero and not empty, so any comparison with it is neither true nor false but unknown, and WHERE keeps only rows that are true. That's why NULLs vanish from filters, never match in joins, and quietly change counts and averages.4 problems to practiseJuniorData tests and reconciliationA data test is a query that returns the rows breaking a rule: no rows means the test passes. Reconciliation compares the same numbers in two places (a source and your table, a payment provider and the ledger) and lists every difference.6 problems to practiseJuniorDeduplication: the latest record per keyMost pipelines receive the same record more than once: a retry re-sends an event, or an order is sent again every time its status changes. Deduplicating means keeping exactly one row per key, and choosing which one by a rule that gives the same answer every run.4 problems to practiseIntermediateNested data: JSON and UNNESTAPIs, webhooks and event streams send nested documents: an order with a list of lines inside it. To analyse them you extract fields with JSON functions and turn each list into rows with UNNEST, one row per element, keeping the parent's columns on each.4 problems to practise
Data modeling
IntermediateAdditive vs. non-additive measuresSome numbers can be added up across any slice: revenue for Monday plus revenue for Tuesday is revenue for both days. Others can't: unique users, averages and ratios give a wrong answer when you add or average them, and that decides what you can safely pre-aggregate.2 problems to practiseIntermediateGrain, facts and dimensionsThe grain of a table is what one row means: "one row per order line", "one row per customer per day". Fact tables hold measurements at a declared grain, dimension tables describe the things they're about, and most wrong numbers come from mixing two grains in one query.6 problems to practiseIntermediateSlowly changing dimensionsCustomers move, products change category, prices change: a slowly changing dimension decides what a table keeps when that happens. Type 1 overwrites the old value; type 2 keeps every version with the dates it was valid, so you can ask what was true at any point in time.4 problems to practise