Checking data after an action
After an action, the screen can look right while the stored data is wrong. Compare the two, and hunt for repeats, missing links and moved data that no longer matches.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: posting a letter. After you post a letter you check three things. Was the stamp the right amount? Did the box keep a second copy? Did the letter name a door that exists?
Daily List is a to-do list app. Lily marks a task done, and the screen shows one card. Tom, the tester, asks whether the stored rows match that card.
What it is: A compares the stored rows with the rule the screen claims to follow. A is a second copy of a task that should exist once. An orphan record is a row whose partner is missing, such as a reminder for a task that is not in the table. SQL (Structured Query Language) is the language the check is written in. A table is a grid, a row is one item, and a column is one fact about that item. A total count is easy to mix up with these checks. A count of 3 can look tidy while a duplicate and an orphan are both sitting in the tables.
Why it matters: The screen can hide the second Buy milk. It can also hide a reminder that points at nothing. The harm shows up later, when the reminder fires for a task nobody can open.
A letter is sent once. Data is changed again and again, so the check runs after each kind of action.
(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)
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 Checking that stored data matches the rule after an action.
- Is the value right
- Is there a second copy
- Does the link still lead somewhere
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| Stamp | Data value |
| Second copy in the box | Duplicate row |
| Letter to a gone address | Orphan record |
| Checking the post | Data check |
WHERE THIS PICTURE STOPS
- A letter is posted once. Data changes again and again.
- A post box shows what it holds. A database needs a query.
- A stamp is right or wrong. A data rule may allow exceptions.
HOOK
Stamp, copy, address.
REMEMBER IT THIS WAY
A contrast: two neighbours told apart by one test.
Duplicate asks: is there a second copy? Orphan asks: has the related record gone?
| In the trick | What it stands for |
|---|---|
| Duplicate row | a second copy of a record that should exist once |
| Orphan record | a row whose related record has gone |
TELL A FRIEND
After posting a letter, check the stamp, the box and the address. After an action, check the value, the repeats and the links.
OFTEN MIXED UP WITH Looking at data with SQL SELECT. The Structured Query Language () lesson shows how to read rows. This lesson says what to look for in them.
PRACTISE AND KEEP
Sources for this topic — 8 sources
- Market practice
Extract, transform, load (ETL) testing: testing in ETL and data-centric projects (EuroSTAR Huddle) ↗ — EuroSTAR Huddle · Checks on moved data include row counts, sums and a row-by-row comparison; counts alone are not enough (search excerpt, page not opened)
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.
- Market practice
How to find duplicate rows in PostgreSQL (Command Prompt education) ↗ — Command Prompt · Group by the columns that should be unique, keep groups with a count above one, and leave the primary key out of the grouping (search excerpt, page not opened)
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.
- Market practice
PostgreSQL left join (Hyring learning pages) ↗ — Hyring · A left join with a test for a missing key finds rows that have no match (search excerpt, page not opened)
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.
- Market practice
PostgreSQL foreign key (Devart blog) ↗ — Devart · A foreign key stops rows from pointing at a parent that does not exist (search excerpt, page not opened)
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.
- Market practice
PostgreSQL WHERE (Neon PostgreSQL tutorial) ↗ — Neon · SELECT with a WHERE clause reads only the rows whose condition is true (search excerpt, page not opened)
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.
- Market practice
Combining Queries: UNION, INTERSECT, EXCEPT (PostgreSQL documentation) ↗ — PostgreSQL Global Development Group · Checked on PostgreSQL 16.15: source ids 1,1,2 against target 1,2 gave an empty EXCEPT while the counts were 3 and 2. SQLServerCentral 'Caution with EXCEPT' (search excerpt, page not opened).
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
Caution with EXCEPT (SQLServerCentral) ↗ — SQLServerCentral · Checked on PostgreSQL 16.15: source ids 1,1,2 against target 1,2 gave an empty EXCEPT while the counts were 3 and 2. SQLServerCentral 'Caution with EXCEPT' (search excerpt, page not opened).
Found through a web search; the page was not opened (search excerpt, page not opened). 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.
- Implementation-specific
PostgreSQL documentation ↗ — The PostgreSQL Global Development Group · PostgreSQL 18 official manual, opened 2026-11-06: queries-union, functions-aggregate and transaction-iso. Supports only PostgreSQL behavior; earlier execution evidence remains separately versioned.
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/postgresdocumentation 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.
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.