Write a SQL query to calculate the daily driver retention rate over a 30-day period for Uber Drivers.
Use the activity records from January 1 through January 30, 2024. For each day after January 1, calculate retention as the number of drivers active both that day and the previous day divided by the number active on the previous day. Return NULL when the previous day's active count is zero.
activity_date, active_drivers, prior_day_active_drivers, and retention_rate.| Column | Type | Description |
|---|---|---|
| driver_idPK | INT | Unique Uber driver identifier |
| signup_date | DATE | Date the driver joined Uber Drivers |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique driver activity record identifier |
| driver_id | INT | Driver associated with the activity |
| activity_date | DATE | Calendar date on which the driver was active |