Chapter 5 · 6 levels
JOINs
Combine tables: INNER and LEFT joins, finding missing matches, the LEFT JOIN + WHERE trap, fan-out double counting and self-joins.
StartReal questions rarely live in one table. Revenue is in order_items, the category is in products,
the status is in orders, and the customer’s name is in customers. Joins put them together.
They are also where experienced analysts still make expensive mistakes: rows that vanish because a filter turned a LEFT JOIN into an INNER JOIN, or totals that double because one order matched many lines. This chapter teaches the joins and, just as importantly, how to check that a join did what you think. The boss level is a category scorecard with revenue, return rates and top customers.
Levels
- Customers who never ordered
from Lauren Hayes, Email Marketing Manager
left join, anti join, is null
- App orders per business customer
from Daniel Foster, Mobile Product Manager
left join, on vs where, count, zero rows
- Lines per order without double counting
from Kevin Brooks, Operations Manager
fan out, one to many, count distinct, grain
- Boss: category scorecard
from Megan Collins, Head of Sales
inner join, left join, multi join, rates, top n