Your question is Monthly User Engagement Trend Analysis. Start with the requirements and the three 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.
StreamWave wants to analyze how user behavior changes over time. Write a PostgreSQL query to summarize monthly user activity for each signup cohort month.
Your query should focus on users who signed up in January or February 2024 and measure their behavior during the first 3 calendar months starting from their signup month.
signup_month and activity_month.engagement_status column:
high if average events per active user is at least 2low otherwisesignup_month, then activity_month.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| signup_date | DATE | Date the user registered |
| acquisition_channel | VARCHAR(50) | Marketing acquisition source |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique event identifier |
| user_id | INT | User who generated the event |
| event_date | DATE | Date of the event |
| event_type | VARCHAR(50) | Type of user action |
| device_type | VARCHAR(20) | Device used for the event |
| Column | Type | Description |
|---|---|---|
| subscription_idPK | INT | Unique subscription identifier |
| user_id | INT | User tied to the subscription |
| plan_name | VARCHAR(30) | Subscription plan name |
| start_date | DATE | Subscription start date |
| end_date | DATE | Subscription end date if canceled |