Write a SQL query to find the month-over-month retention rate of customers who purchased a specific policy.
Use the policy identified by policy_code. Include only customers with non-null purchase dates. A customer is retained for a month if the same customer purchased the policy during the immediately following calendar month.
cohort_month, cohort_customers, retained_customers, and retention_rate.retention_rate as a percentage rounded to two decimal places, ordered by cohort_month ascending.| Column | Type | Description |
|---|---|---|
| policy_idPK | INT | Unique policy identifier |
| policy_code | VARCHAR(30) | Business code used to identify a policy |
| policy_name | VARCHAR(100) | Display name of the insurance policy |
| Column | Type | Description |
|---|---|---|
| purchase_idPK | INT | Unique purchase identifier |
| customer_id | INT | Customer who purchased the policy |
| policy_id | INT | Purchased policy identifier |
| purchase_date | DATE | Date the policy was purchased |