SQLQuokka
Start practicing
QuestionsLearnSandboxFeaturesRoadmapFAQ

Amazon: Prime Monthly Churn Rate

Unsolved

Amazon Prime finance teams monitor subscription health through monthly churn metrics. For each calendar month in the provided `subscription_months` calendar table, calculate: 1. `active_start`: The count of subscribers active at the beginning of the month (i.e. `start_date < month_start` and (`cancel_date IS NULL` OR `cancel_date >= month_start`)). 2. `cancelled_during`: The count of subscribers who cancelled their subscription during that month (i.e. `cancel_date >= month_start` AND `cancel_date <= month_end`). 3. `churn_rate`: The monthly cancellation percentage calculated as `ROUND(100.0 * cancelled_during / active_start, 2)`. If `active_start = 0`, report 0.00. Return `calendar_month` (e.g. '2025-01', '2025-02'), `active_start`, `cancelled_during`, and `churn_rate`. Order results chronologically by `calendar_month ASC`. Note: CTE support requires DuckDB / full SQL engine capabilities. This question is staged for the upcoming DuckDB browser engine.

SQL Query Editor (Ctrl+Enter to run)
0 characters · Valid
Canonical Solution Official

Official Solution is Hidden

Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.

Community Q&A & Discussion

Ask questions, share alternate queries, and explore solutions

0 comments
Asked By:
🏢 Amazon

Submission History

Your recent query executions and answer checks

Execution Pipeline:
FROM subscription_months
Full source dataset
3 rows total
Ready. Type a query to see live execution.
Clause: Auto-Sync · AlaSQL Engine