Members Who Qualify for Loyalty Points (List)
Problem
A gym chain logs every membership renewal a member makes. Table `renewals` has `(member_id, renewed_at, fee_cents)` and the pair `(member_id, renewed_at)` is unique.
A member qualifies for loyalty points if they made at least one renewal during the inclusive window from '2023-09-01' to '2023-09-30' that cost at least 5000 cents.
Report the `member_id` of every qualifying member, ordered by `member_id` ascending.
Tables
Example rows — the live problem includes the full dataset.
| member_id | renewed_at | fee_cents |
|---|---|---|
| 1 | 2023-09-04 10:00:00 | 5200 |
| 1 | 2023-09-18 11:00:00 | 5200 |
| 2 | 2023-09-10 09:00:00 | 4000 |
Expected output
Your answer should return 2 rows with the columns member_id.
Starter code (SQL)
SELECT *
FROM renewals;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