SQL JOINs (INNER / LEFT / RIGHT / FULL)

The resident list and the household cards at the village office, paired by no_kk by a real SQLite: INNER, LEFT, RIGHT, FULL, CROSS. See who has no partner and…

Why it matters

JOIN is the core of relational SQL: data is split over many tables precisely so it can be paired again. Picking the wrong JOIN, putting a condition in WHERE instead of ON, or forgetting the ON are the quietest data bugs: the result looks fine but silently loses or doubles rows.

The key idea

Every kind of JOIN differs in one thing only: the fate of a row with no partner

Common mistakes

Try it in this playground