Your question is Rank Users by Cohort Activity. 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.
Alpaca wants to compare user engagement among customers who joined during the same month. Write a PostgreSQL query that ranks users by their qualifying Alpaca app activity within each signup-month cohort.
YYYY-MM format.| Column | Type | Description |
|---|---|---|
| user_idPK | INTEGER | Unique Alpaca user identifier |
| display_name | VARCHAR(100) | User display name |
| signup_date | DATE | Date the user joined Alpaca |
| Column | Type | Description |
|---|---|---|
| event_idPK | INTEGER | Unique activity event identifier |
| user_id | INTEGER | User associated with the event |
| event_type | VARCHAR(50) | Type of Alpaca app activity |
| occurred_at | TIMESTAMP | Timestamp when the activity occurred |