Your question is Subscriber Retention Over 90 Days. 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.
Disney+ Hotstar wants to measure whether new paid subscribers remain subscribed at least 90 days after their first paid subscription begins. Write a PostgreSQL query that produces retention metrics by signup cohort and acquisition channel.
NULL end date represents an ongoing subscription and counts as retained.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique subscriber identifier |
| signup_date | DATE | Date the user registered |
| acquisition_channel | VARCHAR(40) | Marketing channel that acquired the user |
| Column | Type | Description |
|---|---|---|
| subscription_idPK | INT | Unique subscription record identifier |
| user_id | INT | References users.user_id |
| plan_id | INT | References plans.plan_id |
| start_date | DATE | Date the subscription began |
| end_date | DATE | Date the subscription ended, or NULL when ongoing |
| Column | Type | Description |
|---|---|---|
| plan_idPK | INT | Unique plan identifier |
| plan_name | VARCHAR(60) | Display name of the subscription plan |
| plan_tier | VARCHAR(20) | Plan tier such as Mobile, Super, Premium, or Trial |
| is_paid | BOOLEAN | Indicates whether the plan is paid |