Missing, invalid and stale data
Before anyone trusts a report, an analyst checks the data underneath it. Most checks are short queries that count the rows that break a rule. Zero means the rule holds.
Completeness: is anything missing that shouldn't be?
SELECT COUNT(*) FROM customers WHERE region IS NULLValidity: are values sensible?
SELECT COUNT(*) FROM order_items WHERE quantity <= 0
SELECT COUNT(*) FROM marketing_campaigns WHERE end_date < start_date
SELECT COUNT(*) FROM customers WHERE email NOT LIKE '%_@_%._%'Uniqueness: are things that should appear once really unique? (You did this in Tier 3 with
GROUP BY … HAVING COUNT(*) > 1.)
Freshness: is the data up to date? SELECT MAX(order_date) FROM orders should be yesterday or
today. If it's last week, the nightly load has failed and every report is stale.
Remember that some NULLs are normal: an online order has no employee_id, and a consumer has no
credit_limit. A check has to know the business to know what's wrong.