Your question is SQL for Membership Churn. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Amazing Lash Studio wants a monthly view of membership churn based on activity in its reservation logs. Write a PostgreSQL query for January through April 2025.
A member counts in the monthly active base when they have at least one completed reservation during the month and their membership was active on the reservation date. A member counts as churned when their membership cancellation date falls in that same month.
| Column | Type | Description |
|---|---|---|
| membership_idPK | INTEGER | Unique membership identifier |
| member_id | INTEGER | Stable identifier for the member |
| member_name | VARCHAR(100) | Member name |
| start_date | DATE | Membership activation date |
| cancellation_date | DATE | Membership cancellation date |
| Column | Type | Description |
|---|---|---|
| reservation_idPK | INTEGER | Unique reservation identifier |
| membership_id | INTEGER | Membership associated with the reservation |
| reservation_date | DATE | Date of the reservation |
| reservation_status | VARCHAR(20) | Reservation outcome |