Audit a table you have been told to trust
You have inherited a `customers` table that a downstream team relies on. Audit it and report what is wrong: duplicate identities, orphaned foreign keys, NULLs in fields the schema says are required in practice, and values outside plausible ranges. Report findings ranked by how much damage each would do downstream, with a reproducing query for each.
What you have to hand in
- At least four distinct classes of problem are checked.
- Every finding names the table, column and affected row count.
- Every finding ships with a query the reader can run themselves.
- Findings are ranked, and the ranking is justified.
- Each finding is verified against the source tables, so none of them is an artefact of the audit's own joins.
The checklist, published before you start
- Checks cover the real failure modes
The audit looks for duplicates, orphaned references, NULLs in required fields, and out-of-range values.
- Only one class of problem is checked.
- Two classes checked; obvious gaps remain.
- All four classes checked.
- All four, plus at least one domain-specific check the brief did not name.
- Findings are specific and actionable
Each finding names the table, column and row count affected.
- Findings are vague ("some data is bad").
- Findings name the table but not the scale.
- Every finding names table, column and affected row count.
- Findings also include a reproducing query someone else can run.
- Findings survive scrutiny
Reported problems are genuine, not artefacts of the audit query itself.
- Several findings are caused by the audit's own joins.
- One finding is a false positive.
- All findings verified against the source tables.
- Verified, with the verification shown.
- Findings are ranked by impact
The reader can tell which problem to fix first and why.
- An unranked list.
- Ranked, but the ranking is not justified.
- Ranked by a stated notion of impact.
- Ranked, justified, and tied to a concrete downstream consequence.
The skills a pass would prove
- DISTINCT and duplicate controlDetect where duplicate rows came from and remove them at the right point in the query
- Semi and anti joinsFind rows that do or do not have a match without changing the result grain
- NULL semanticsPredict and control how NULLs affect a filter, a join and an aggregate
- Validating a resultCheck a query result for correctness before trusting it, and say what you checked
This brief is part of the SQL & Data Analysis course
Starting it starts the course: every skill above, in the order they depend on each other, with this brief at the end as the thing you hand in — marked against the checklist you have just read and nothing else.
Start the SQL & Data Analysis course