Everything useful before you download or buy.
Which rows a join keeps, how many it returns, and the joins that give a wrong number without an error.
Two A4 pages on SQL joins, written on the datasets of the LucidPlexus books: Lanternfield's startups, Verdant Union's emissions and water use, and the agricultural exports. Every query was run in DuckDB, and its real result is printed under it.
It covers inner, left, right, full, semi and anti joins counted in rows; keys and cardinality, and how to profile both sides before joining; fan-out, with a sum that comes out 18.2 times too big, and how to detect it; aggregating before you join; many-to-many joins; keys spelled differently; NULL keys and NOT IN; USING, ON and NATURAL; the self-join; and the same checks in pandas with merge.
It ends with a checklist to run before every join.
PDF to print, and an HTML version to read on screen. The SQL is DuckDB, with notes where other databases differ (SEMI and ANTI JOIN, IS NOT DISTINCT FROM).
Check the resource before buying — a limited-page preview.
This is a limited-page preview. If it does not load, open the PDF directly.
One review per person. Submitting again updates your existing review.
Be the first to review this resource.