Write a SQL query to calculate week-over-week retention rates for new rider activations across different geographic markets.
Use the riders and rides tables. Treat a rider as retained when they complete at least one ride during a given week after activation. Calculate weeks 0 through 4 relative to each rider's activation week.
market, activation_week, retention_week, activated_riders, retained_riders, and retention_rate.market, activation_week, and retention_week ascending.| Column | Type | Description |
|---|---|---|
| rider_idPK | INT | Unique rider identifier |
| market | VARCHAR(50) | Geographic market where the rider activated |
| activation_date | DATE | Date when the rider first activated |
| Column | Type | Description |
|---|---|---|
| ride_idPK | INT | Unique ride identifier |
| rider_id | INT | Rider who completed the ride |
| ride_date | DATE | Date when the ride was completed |