A pattern I keep seeing when people practice SQL for analyst interviews.
The question: "Return every active subscription paying at least $1,500 a month."
A very common answer:
SELECT company_name, plan_tier, monthly_amount
FROM subscriptions
WHERE status = 'active'
AND monthly_amount > 1500
ORDER BY monthly_amount DESC;
It runs, it returns rows, and it looks right. But "at least" means >=, so the customer paying exactly 1500.00 silently disappears. In an interview the query "works", so you don't notice. Against the expected output it's simply wrong.
Things worth checking every time a question has a threshold:
- "at least" / "minimum of" -> >=
- "more than" / "over" -> >
- "between" -> BETWEEN is inclusive on both ends; dates with timestamps need care
- Does the sample data contain a row exactly on the boundary? Interviewers often add one on purpose.
I built a free practice site around this kind of feedback: you write real PostgreSQL in the browser and it shows you which rows are missing or extra compared to the expected result. This exact problem is the first one, no signup: https://dbexercises.vercel.app/exercise/saas-active-subscriptions
Happy to hear what other "looks right, is wrong" traps you've run into.