SQL for BAs: comparing two sources (reconciliation)
Two systems should agree, and often do not. Learn the usual steps to match two lists, find what is missing on each side and find values that differ.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: a delivery against an order. You have an order list and a delivery note. You tick the lines that match. Some lines are only on the order. Some are only on the note. Some match by name, but the quantity differs. One check makes three lists.
Daily List is a made-up to-do app (SYNTHETIC / TRAINING ONLY). Sam, the , compares the tasks in the old app with the tasks in the new copy. Nina, the , will not sign the move until the two lists agree.
What it is: (Structured Query Language) is a language for asking a database questions. A table is a grid, a row is one task, and a column is one fact, such as the title. compares two sources that should hold the same things. A match key is the column that says two rows are the same task, here id. A full outer join keeps every row from both tables and leaves a blank where the other side has no match. Its neighbour is an inner join, which keeps only the rows that match and hides the gaps.
Why it matters: An inner join of these two lists shows two tasks and looks tidy. It hides three tasks that exist on only one side. Sam would tell Nina the copy is complete when it is not. The three lists are the evidence.
A paper tick is enough for four lines. A real move has more rows, and the same three lists still apply.
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 Ticking an order list against a delivery note.
- Match
- Split
- Report
HOW THE PICTURE MAPS
| In the picture | In the work |
|---|---|
| The order | Source A |
| The delivery note | Source B |
| Item code | Match key |
| Quantity differs | A difference |
WHERE THIS PICTURE STOPS
- A note is short, but tables are huge.
- A person spots a swap, but a query needs a key.
- A delivery ends, but a feed keeps moving.
HOOK
Match, split, report.
TELL A FRIEND
An order against a delivery: only here, only there, different.
OFTEN MIXED UP WITH SQL for BAs: JOIN. That topic matches rows across tables. This one uses joins to compare two sources that should agree.
PRACTISE AND KEEP
Sources for this topic — 4 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
Combining Queries: UNION, INTERSECT, EXCEPT (PostgreSQL documentation) ↗ — PostgreSQL Global Development Group · PostgreSQL 18, §7.4 UNION/INTERSECT/EXCEPT and ALL; publisher page opened6November 2026. Dialect scope explicit.
PostgreSQL18 publisher documentation opened on6November2026: §7.4 UNION/INTERSECT/EXCEPT and ALL. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.
- Market practice
SQLite: SQL expressions ↗ — SQLite project · SQLite: SQL expressions; CASE/BETWEEN/IN/EXISTS, scalar cardinality, NULL-safe equality and parameter values. Publisher page opened6November 2026.
Publisher documentation opened on6November2026. Engine/version scope is explicit; other database implementations may differ. Teaching queries are synthetic, not a required publisher template.
- 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.