Beginner
Open
Pro
A Customer Exclusion Query Silently Returns Nothing
A marketing team runs this query nightly to find customers eligible for a promotional email — everyone who is not on the suppression list:
SELECT customer_id, email
FROM customers
WHERE customer_id NOT IN (
SELECT customer_id FROM suppression_list
);
For months, this returned a reasonable list of a few thousand eligible customers each night. Last night it returned exactly zero rows, and the team is convinced "the database is broken" because no code changed. You're asked to investigate.
- What is the most likely root cause, and what single fact about the
suppression_list.customer_idcolumn would you check first to confirm it? - Explain, mechanically, why this produces exactly zero rows rather than, say, a smaller-than-usual but nonzero list.
- Propose a fix, and explain why it's more robust than just "clean the NULL out of suppression_list today," which only fixes today's symptom.
Share this question