Write a SQL query that computes 7-day rolling user retention from a daily events table, then flags cohorts whose week-over-week retention dropped more than 10%.
Treat each user's cohort as the calendar week containing their first event. Retention for week n is the percentage of cohort users active at least once during the corresponding 7-day interval. Include partially observed final intervals through the latest event date.
cohort_week, week_number, cohort_users, retained_users, retention_rate, prior_retention_rate, and dropped_more_than_10pct.cohort_week, then week_number.| Column | Type | Description |
|---|---|---|
| event_idPK | INTEGER | Unique event identifier |
| user_id | VARCHAR(20) | Identifier of the active user |
| event_date | DATE | Calendar date on which the event occurred |
| event_type | VARCHAR(40) | Optional event classification |