Join types in depth: inner, left, full, cross and self
One word changes the answer. Learn what each join keeps and drops, how to read the row counts, and why a filter in the wrong place quietly changes the join.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: two guest lists. One list is who was invited. The other is who replied. You can keep only people on both lists. You can keep every invited person, even with no reply. You can pair every name with every name.
Daily List is a made-up to-do app (SYNTHETIC / TRAINING ONLY). Sam, the , joins users to tasks. Nina, the , wants every user in the report, including people with no task.
What it is: (Structured Query Language) is a language for asking a database questions. A table is a grid. A row is one user or one task. A column is one fact, such as the name. An keeps one side even when the other side has no match. An unmatched row is the side that has no partner, and it shows up blank. A cross join pairs every row on the left with every row on the right. You type the join in the database program. The neighbour of an outer join is an inner join, which drops the unmatched rows.
Why it matters: The wrong join hides Chen, who has no task, and the report still looks tidy. Nina then thinks every user has work. Sam counts the rows by hand before he sends the number.
Two short lists are easy to count. A live report has more rows, and the same blank still means no match.
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the work.
THE REAL JOB Two guest lists matched in different ways.
- Ask
- Join
- Count
HOW THE PICTURE MAPS
| In the picture | In the work |
|---|---|
| Invited and replied | Inner join |
| Everyone invited | Left join |
| Everyone who replied | Right join |
| Every pair of guests | Cross join |
WHERE THIS PICTURE STOPS
- A guest list has names, but a join uses keys.
- A list is read once, but a join can repeat rows.
- A wedding has one list of each, but a query can join many tables.
HOOK
Which side must be complete?
TELL A FRIEND
Guest lists: each question needs its own match.
OFTEN MIXED UP WITH SQL for BAs: JOIN. That topic introduces joins. This one goes through every join type, row counts and the filter trap.
PRACTISE AND KEEP
Sources for this topic — 3 sources
- Market practice
Table expressions and joined tables (PostgreSQL documentation) ↗ — PostgreSQL · PostgreSQL 18, §7.2 joined tables, grouping and grouping sets; publisher page opened6November 2026. Dialect scope explicit.
PostgreSQL18 publisher documentation opened on6November2026: §7.2 joined tables, grouping and grouping sets. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.
- Market practice
SELECT: compound select statements (SQLite documentation) ↗ — SQLite project · SQLite rolling SELECT documentation opened6November 2026; §§2–5 joins/grouping/bare columns/compound queries/order/limit. UNION ALL supported; INTERSECT ALL/EXCEPT ALL are not. Synthetic fixtures rechecked on3.53.1; historical3.40.1 observations retain their date/version.
SQLite rolling SELECT documentation opened6November2026; §§2–5 joins/grouping/bare columns/compound queries/order/limit. UNION ALL supported; INTERSECT ALL/EXCEPT ALL are not. Synthetic fixtures rechecked on3.53.1; historical3.40.1 observations retain their date/version.
- Simplified educational illustration
Payments Signal editorial teaching models — Payments Signal
What this simplifies: Daily List people, data and exercises are invented for teaching. Query results belong to the declared fixture and database version. Authorization, business identity, time bounds and unknown-value policy must be agreed in context; no universal mandatory query template is implied.
Used wherever diagrams, scenarios, figures, or example values are didactic constructions rather than sourced facts; every such use carries a simplifications disclosure. All people, companies, banks, and list entries in examples are fictional.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.