Uber operations teams are analyzing driver efficiency and trip patterns. To understand driver engagement, we need to calculate the average distance traveled per driver.
Write an SQL query to find the average distance for each driver, but only for trips that have been successfully completed.
Rules:
- Only include trips where the status is completed.
- Trips with statuses like cancelled by driver or cancelled by client must be excluded.
- For drivers who have zero completed trips, they should not appear in the final output.
- The average distance should be rounded to 2 decimal places.
- Output columns: driver_name, avg_distance.
- Results must be sorted by avg_distance in descending order.