Software Testing / Learning brief

Tom compares two lists with set operators

What this means in plain language

Tom joins and compares two Daily List task lists and learns why UNION and UNION ALL give different counts.

Understand the full idea, step by step

Analogy: two guest lists. You can put both lists together, keep the names on both, or find the names on the first list only. Whether you keep a name twice depends on the question.

A total of guests is wrong if a person is on both lists and is counted twice.

Evidence & review

REVIEWED 2026-10-31

The date on this lesson is when it went up on Payments Signal, not when its material was written — most of these were brought across from an earlier catalogue in a single run, which is why so many of them share a date. What the lesson says about the world is dated by the review above and by the sources below it.

Set operators on made-up lists. The people and data are invented.

What this brief simplifies: Fiction labelled SYNTHETIC / TRAINING ONLY. Sources were seen only as search excerpts. Tools and screens change, and each team sets its own.

Sources for this brief — 3 sources
  1. Market practice

    Combining Queries: UNION, INTERSECT, EXCEPT (PostgreSQL documentation) ↗ — PostgreSQL Global Development Group · PostgreSQL documentation: UNION, INTERSECT and EXCEPT combine the results of two queries, drop repeated rows unless ALL is used, and need queries with matching columns (search excerpt, page not opened)

    §7.4 UNION/INTERSECT/EXCEPT and ALL. PostgreSQL18 implementation, not a universal SQL mandate. · Checked 2026-11-06

    PostgreSQL18 publisher documentation opened on6November2026: §7.4 UNION/INTERSECT/EXCEPT and ALL. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.

  2. Market practice

    SELECT: compound select statements (SQLite documentation) ↗ — SQLite project · SQLite documentation: compound select statements combine queries with UNION, UNION ALL, INTERSECT and EXCEPT (search excerpt, page not opened)

    Says EXCEPT returns the rows from the left query that the right query does not produce, and that both sides need the same number of columns. · Checked 2026-11-06

    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.

  3. Simplified educational illustration

    Payments Signal editorial teaching models — Payments Signal

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

    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.

Learn this properly

START HERESQL (Structured Query Language) UNION, UNION ALL, INTERSECT and EXCEPT for testersSometimes you need to join two result lists or find what is in one and not the other. Learn the four set operators and the count traps.Opens at L0 Explain simply · about 14 min

Related briefs