Given a table of daily driver earnings, write a query to calculate the rolling 7-day average of active driver supply by city for Uber Drivers.
Active driver supply is the number of distinct drivers with a row for a city and date. Treat dates without active drivers as zero supply, and calculate averages over calendar days. For the first six dates, average all available dates.
city, activity_date, and rolling_7_day_avg_supply.city, then activity_date.| Column | Type | Description |
|---|---|---|
| earning_idPK | INT | Unique earning record identifier |
| earning_date | DATE | Date of the driver earning record |
| city | VARCHAR(100) | Uber Drivers operating city |
| driver_id | VARCHAR(50) | Driver identifier |
| daily_earnings | DECIMAL(10,2) | Driver earnings for the date |