Your question is Week-over-Week Retention Query. 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.
Asana Spa has launched the Smart Goals feature and wants to measure whether users continue using it after their first use. Write a PostgreSQL query that calculates weekly retention by first-use cohort.
The launch week begins on 2025-01-06, and weeks start on Monday.
0, avoid duplicate events, and order by cohort week followed by activity week.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique Asana Spa user identifier |
| user_name | VARCHAR(100) | User display name |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique feature event identifier |
| user_id | INT | User associated with the feature event |
| feature_name | VARCHAR(100) | Name of the feature used |
| event_at | TIMESTAMP | Timestamp when the feature event occurred |