Interview Guides
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.users| column | type | description |
|---|---|---|
| user_id | INT | Primary key for each user |
| signup_date | DATE | Date the user registered |
| acquisition_channel | VARCHAR(50) | Marketing channel |
events| column | type | description |
|---|---|---|
| event_id | INT | Primary key for each event |
| user_id | INT | User who generated the event |
| event_date | DATE | Event date |
| event_type | VARCHAR(50) | Type of action |
| device_type | VARCHAR(20) | Device used |
subscriptions| column | type | description |
|---|---|---|
| subscription_id | INT | Subscription record |
| user_id | INT | User tied to the subscription |
| plan_name | VARCHAR(30) | Subscription plan |
| start_date | DATE | Subscription start date |
| end_date | DATE | Subscription end date, if canceled |