TOPIC 12/2816 MINNOT STARTED

Join types in depth: what each join keeps, and what to test

A screen that lists tasks with owners hides a join. Learn what inner, left and full joins keep or drop, so you can predict row counts and spot missing rows.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: matching tickets to coats. The clerk can list only coats that have a ticket. Or every ticket, even when the coat is missing. Or every coat, even when the ticket is missing. The three lists have different lengths. A fourth list pairs every ticket with every coat, which is almost never what you want.

Daily List is a to-do list app. A screen shows each task beside the person who owns it. Tom, the tester, predicts how many rows that screen should have before he trusts it. (SYNTHETIC / TRAINING ONLY: Daily List and the people here are invented.).

What it is: A join is the (Structured Query Language) step that pairs rows from two tables. SQL is the language for asking a database questions and for changing it. A table is a grid. A row is one record, such as one user or one task. A column is one fact, such as a name or a title. An inner join keeps only pairs. A also keeps every left row. A right join also keeps every right row. A full join keeps both. The easy mix-up is left versus inner: a left join keeps a row with no match, and an inner join drops it.

Why it matters: A wrong join hides Lily's empty list, or it repeats Sam's tasks. The screen will not warn Tom. He has to count.

A is that count. A is the user with no task, or the task with no user. A product of two tables is every row of one paired with every row of the other, which is what a missing condition does.

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.

THE REAL JOB A coat check with three different lists.

  1. Predict
  2. Run
  3. Compare
Coat check

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
Coats with ticketsInner join
All ticketsLeft join of tickets
All coatsRight join
Every ticket with every coatProduct of two tables

WHERE THIS PICTURE STOPS

  • A coat check is small, but a table is large.
  • A list is read once, but a join can repeat rows.
  • A person checks the list, but a test compares counts.

HOOK

Predict, then count.

TELL A FRIEND

A coat check: three lists, three lengths.

OFTEN MIXED UP WITH Joins and grouping: check data across tables. That topic joins and groups rows. This one goes through each join type and the counts to predict.

PRACTISE AND KEEP

Sources for this topic — 5 sources
  1. Market practice

    Table expressions and joined tables (PostgreSQL documentation) ↗ — PostgreSQL · PostgreSQL reference: inner join is the default, left, right and full are outer joins, a cross join pairs every row with every row, and an ON condition in an outer join acts before the join where a WHERE condition acts after it (search excerpt, page not opened)

    The PostgreSQL reference for joined tables: inner, left, right, full and cross joins, and how an ON condition differs from a WHERE condition in an outer join. Official project documentation. · Checked 2026-10-31

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  2. Market practice

    Joins between tables (PostgreSQL tutorial) ↗ — PostgreSQL · PostgreSQL tutorial: a left join keeps every row from the left table and fills the right-side columns with nulls when nothing matches (search excerpt, page not opened)

    The PostgreSQL tutorial page on joins, which says a left join keeps every row from the left table and fills the right side with nulls when nothing matches. Official project documentation. · Checked 2026-10-31

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  3. Implementation-specific

    PostgreSQL documentation ↗ — The PostgreSQL Global Development Group · PostgreSQL 18 official manual, opened 2026-11-06: queries-table-expressions §7.2, SQLite3.39.0 release notes and MySQL8.4 JOIN grammar. Supports only PostgreSQL behavior; earlier execution evidence remains separately versioned.

    A free, precise, section-numbered description of the SQL a payments practitioner actually writes. Join types and what happens to unmatched rows, GROUP BY and HAVING against WHERE, window functions and the de-duplication and running-total idioms built on them. Transaction isolation levels and the anomalies each permits, index use, and null three-valued logic.

    Used here for the data-and-SQL questions a Payment Operations Analyst, a Production Support Analyst and a Sanctions Screening Analyst are asked. · Checked 2026-08-18

    An implementation, not the standard — which is the point. ISO/IEC 9075-2 is paywalled, and this documents the same constructs in text anybody can open. Its isolation-level chapter attributes to the standard explicitly, so it can carry a standard-level claim as long as the citation says which document it is quoting.

    Cited as market practice rather than an official standard by kind: an engine's manual is authoritative about that engine and is not the obligation. Where a question turns on behaviour PostgreSQL chose rather than behaviour SQL requires, the answer has to say so.

    One correction carried here because it circulates widely: the sentence "The fundamental difference between WHERE and HAVING…", quoted all over the internet as PostgreSQL documentation, is not in the current documentation. It was searched for in the source tree and is not there.

    Read through a mirror, because the publisher's own domain could not be fetched (a reachability gap, not a statement about the publisher). A 403 there is a policy refusal and says nothing about whether the document exists or is reachable elsewhere.

    Anyone on an unrestricted network should open the canonical URL above and confirm the section and page numbers cited against it. Every claim drawn from this entry is written so that it can be checked against a numbered page.

    Read from the postgres/postgres documentation source tree (doc/src/sgml), which the project itself maintains and which carries the section ids the published URLs are derived from — so a cited section id can be checked against the rendered page.

  4. Implementation-specific

    SQLite official documentation — constraints, types and transactions ↗ — SQLite · SQLite rolling official documentation, opened 2026-11-06: foreignkeys.html, datatype3.html, lang_createtable.html, lang_transaction.html, isolation.html, cli.html, series.html and lang_createtrigger.html as relevant. Historical SQLite 3.40.1 results remain distinct from in-memory audit witnesses on 3.53.1.

    Implementation-specific SQLite documentation, not a universal SQL standard. Includes foreign-key enforcement, type affinity, CREATE TABLE/TRIGGER, explicit/implicit transaction behavior, isolation, CLI and series extension references. · Checked 2026-11-06

    Relevant primary pages opened 6 November2026; rolling documentation and CLI examples (3.54.0) are distinct from historical lesson runs3.40.1 and audit witnesses3.53.1. No file/connected database audit execution.

  5. Implementation-specific

    MySQL8.4 Reference Manual — JOIN Clause ↗ — Oracle / MySQL · MySQL8.4 Reference Manual §15.2.13.2 JOIN grammar, opened 2026-11-06: native LEFT and RIGHT outer joins, no FULL OUTER JOIN production. No MySQL runtime used.

    MySQL8.4 implementation grammar: INNER/CROSS/LEFT/RIGHT joins; no native FULL OUTER JOIN. Not a claim about every SQL product. · Checked 2026-11-06

    Primary grammar opened2026-11-06. Documentation verification only; no MySQL database run.

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.