Write a query to calculate the rolling 30-day retention rate for our top-tier legal firm customers.
Use the customers and customer_activity tables. For each date on which a top-tier customer was active, calculate the percentage of that date's top-tier active customers who were active again during the following 30 days.
activity_date, active_customers, retained_customers, and retention_rateactivity_date ascending, and report retention_rate as a percentage rounded to two decimal places| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique legal firm customer identifier |
| firm_name | VARCHAR(255) | Legal firm name |
| customer_tier | VARCHAR(50) | Customer service tier |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity event identifier |
| customer_id | INT | Customer associated with the activity |
| activity_date | DATE | Calendar date of customer activity |