Prime Video wants to track how many subscribers stop being active from one month to the next. Given a subscriptions table, calculate the month-over-month churn rate for every month in 2025. A user is active in a month if their subscription started before the next month and has not ended before the beginning of that month. A user churned in a month if they were active during the previous month but were not active during the current month. Return the month, the number of users active in the previous month, the number of churned users, and the churn rate as a percentage rounded to two decimal places. If there were no active users in the previous month, return a churn rate of `0.00`. Sort the results chronologically by month. ### Table Schema | Table | Column | Type | |---|---|---| | subscriptions | subscription_id | integer | | subscriptions | user_id | integer | | subscriptions | start_date | date | | subscriptions | end_date | date | ### Example Input: subscriptions | subscription_id | user_id | start_date | end_date | |---:|---:|---|---| | 1 | 101 | 2024-12-01 | NULL | | 2 | 102 | 2024-12-01 | 2025-01-31 | | 3 | 103 | 2025-01-01 | 2025-02-28 | | 4 | 104 | 2025-01-15 | 2025-01-31 | ### Example Output Explanation In January, two users were active in December and both remained active in January, so the churn rate is 0.00%. In February, four users were active in January, but users 102 and 104 were no longer active, producing a churn rate of 50.00%.
DROP TABLE IF EXISTS subscriptions; CREATE TABLE subscriptions ( subscription_id INT, user_id INT, start_date DATE, end_date DATE ); INSERT INTO subscriptions VALUES (1, 101, '2024-12-01', NULL), (2, 102, '2024-12-01', '2025-01-31'), (3, 103, '2025-01-01', '2025-02-28'), (4, 104, '2025-01-15', '2025-01-31');