AnalystPath

Members Who Qualify for Loyalty Points

SQLEasyJunior level~15 min

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 a single column `qualifying_members`: the number of distinct members who qualify.

Tables

Example rows — the live problem includes the full dataset.

renewals
member_idrenewed_atfee_cents
12023-09-04 10:00:005200
12023-09-18 11:00:005200
22023-09-10 09:00:004000

Expected output

Your answer should return 1 row with the columns qualifying_members.

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

Related SQL questions