Data Analystdata analyticsintermediate3 interactive MCQs in app
SQL joins
INNER vs LEFT JOIN row preservationWHERE filter collapsing LEFT JOIN to INNER1-to-many join fan-out inflation
Core Concept
INNER JOIN keeps only keys present in BOTH tables. LEFT JOIN preserves ALL rows from the left table, filling unmatched right-table columns with NULL. Two major bugs hit real analysts: (1) filtering a right-table column in WHERE (`WHERE right.status = 'paid'`) silently turns a LEFT JOIN back into an INNER JOIN by dropping NULL-padded unmatched left rows! Put right-table conditions inside ON instead, or check IS NULL for anti-joins. (2) Joining 1-to-many tables multiplies left-table rows (fan-out), double-counting revenue unless you pre-aggregate first.
Worked Example
`SELECT u.id, COUNT(o.id) FROM users u LEFT JOIN orders o ON u.id = o.user_id AND o.amt > 40 GROUP BY 1` keeps users with `0` qualifying orders, whereas moving `o.amt > 40` to `WHERE` drops them!
Common Pitfall
putting right-table non-null predicates in WHERE after LEFT JOIN, or summing amounts across a duplicated join.
Recommended Readings & Practice
Practice SQL joins with 3 graded MCQs & written feedback.
Take SOARDO’s free 12-question diagnostic to see how strong you are across your target role and unlock adaptive daily missions.