Write a SQL query to find the average weekly earnings of drivers who completed their first trip in the last 30 days, grouped by city at Uber Drivers.
Use CURRENT_DATE as the reference date. Treat a driver's first trip as their earliest completed trip, and calculate the average from recorded weekly earnings for eligible drivers.
Output
- One row per city, including cities with eligible drivers but no recorded earnings
- Columns:
city, average_weekly_earnings
- Exclude drivers whose earliest completed trip is outside the last 30 days
- Sort by
city ascending, with NULL cities last