Traps & Trick QuestionsMedium
When does a LEFT JOIN silently become an INNER JOIN?
Seen at: Meta · Uber · DoorDash
You want all users, whether or not they’ve placed orders. You write:
SELECT u.id, o.total
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE o.status = 'paid';
A user with no orders disappears from the result. Why?
Draft your answer
Saved to this browser only. Try it before you peek at the model answer.
Stuck? Peek at a hint
Reveals the model answer and the self-score rubric.