Join traps, and how to detect them
A badly written join runs without errors and returns a number that looks plausible but is wrong. The lesson walks you through the most costly mistakes in product analyses and a simple way to catch them before you share a result. Enough to stand behind your revenue or usage numbers in front of the data team.
Lesson objective
By the end of this lesson, you will be able to recognize and fix the two most costly join errors (row fan-out that inflates sums, and a filter placed in WHERE that cancels a LEFT JOIN), by reasoning about the grain of each table and checking the row count.
Topics covered
- join errors
- table grain
- LEFT JOIN
- SQL duplicates
- result check
In the glossary
Where it fits
Combine tables
How do I combine several tables without losing rows or inflating my numbers?
Lessons in this module
- Join tables with INNER JOIN and LEFT JOIN
- Join traps, and how to detect them (this lesson)
What you will learn in this module
This lesson is part of the course Model your product’s data and query it with SQL
- Combine several tables with INNER and LEFT joins, and check that the result neither loses nor duplicates any row.
Related courses
- Product ManagementAdvancedRegular practice: you already use the tools or work on this topic.
Git for PMs: ship as a team without putting production at risk
3 hr 30 min
- Tech for PMsAll levelsNo prerequisites: accessible to everyone.
Explain how a web product works, from browser to server
2 hr 30 min
- Tech for PMsJuniorSome basics are useful: introductory knowledge of the topic.
Design and test an API integration as a PM
3 hr