Big-Spender Diners
Problem
A restaurant keeps a `checks` table: each row is `(check_id, diner_id, total_dollars)`, one paid bill.
A diner is a 'big spender' if they have at least one check whose `total_dollars` exceeds 80. Report a single column `big_spenders`: the number of distinct diners who are big spenders.
Tables
Example rows — the live problem includes the full dataset.
checks
| check_id | diner_id | total_dollars |
|---|---|---|
| 1 | 10 | 95 |
| 2 | 10 | 40 |
| 3 | 11 | 30 |
Expected output
Your answer should return 1 row with the columns big_spenders.
Starter code (SQL)
SELECT *
FROM checks;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock