Rides
table with the AcceptedRides
table to get the total ride_distance
and ride_duration
for each month.AVG()
with the ROWS BETWEEN
clause to calculate the rolling average over the current and next two months.erDiagram DRIVERS ||--o{ RIDES : has RIDES ||--o{ ACCEPTEDRIDES : has DRIVERS { int driver_id PK date join_date } RIDES { int ride_id PK int user_id date requested_at } ACCEPTEDRIDES { int ride_id PK int driver_id int ride_distance int ride_duration }