TOPIC 15/3015 MINNOT STARTED

Anti-joins: finding what has no match

Which users have no task? Which tasks have no owner? Learn three ways to ask, and why one of them, NOT IN, can quietly return nothing when a null is present.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: the reply list against the guest list. You want the invited people who sent nothing back. You are looking for an absence. A blank on the reply list is the answer, not a name that appears on both.

Daily List is a made-up to-do app (SYNTHETIC / TRAINING ONLY). Sam, the , looks for users who have no task. Nina, the , wants to nudge them. Chen is the person.

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, and a column is one fact. An anti-join returns rows from one table that have no match in the other. An asks whether any matching row is there, usually with NOT EXISTS. The not-in trap is a NOT IN list that contains a null. When no value matches the user’s key, the test is unknown. You write it as a query. The neighbour of NOT EXISTS is NOT IN, which looks the same until a null appears.

Why it matters: NOT IN on this data returns nobody. Chen is missed, and the query shows no error. Sam would tell Nina that every user has a task.

A paper list shows the gap as an empty tick. A null in a query can erase the gap instead.

PLAIN WORDS · 1 in this section
nudge
a small push or prompt to do something

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 A coat check with a stub box and one torn stub.

  1. Ask
  2. Check
  3. Count
Coat check

HOW THE PICTURE MAPS

How each part of the picture matches the work
In the pictureIn the work
A coat with no ticketA row with no match
Walking the racksA left join
Asking if a stub matchesNOT EXISTS
A torn stubA null in the list

WHERE THIS PICTURE STOPS

  • A torn stub is visible, but a null is silent.
  • A coat check is small, but tables are large.
  • A person decides, but a query follows rules.
  • With NULL in the inner list, an equal match makes NOT IN false; a nonmatch becomes unknown. A nullable outer identity also needs an explicit policy.

HOOK

Ask safely.

TELL A FRIEND

A coat check: one torn stub breaks the lazy rule.

OFTEN MIXED UP WITH SQL for BAs: UNION, EXCEPT and EXISTS. That topic covers and . This one compares three ways to find what has no match.

PRACTISE AND KEEP

Sources for this topic — 3 sources
  1. Market practice

    Subquery Expressions (PostgreSQL documentation) ↗ — PostgreSQL Global Development Group · PostgreSQL 18, §9.24 EXISTS/IN/NOT IN NULL semantics; publisher page opened6November 2026. Dialect scope explicit.

    §9.24 EXISTS/IN/NOT IN NULL semantics. PostgreSQL18 implementation, not a universal SQL mandate. · Checked 2026-11-06

    PostgreSQL18 publisher documentation opened on6November2026: §9.24 EXISTS/IN/NOT IN NULL semantics. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.

  2. 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.

    §7.2 joined tables, grouping and grouping sets. PostgreSQL18 implementation, not a universal SQL mandate. · Checked 2026-11-06

    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.

  3. Simplified educational illustration

    Payments Signal editorial teaching models — Payments Signal

    This site's own simplified teaching models. · Checked 2026-07-12

    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.