Identify the top 10% of drivers by earnings using a window function.
Calculate each driver's total earnings from completed rides, including drivers with no completed rides. Treat missing earnings as zero and use all available ride records.
driver_id, driver_name, and total_earningstotal_earnings descending, then driver_id ascending for deterministic tie-breaking| Column | Type | Description |
|---|---|---|
| driver_idPK | INT | Unique driver identifier |
| driver_name | VARCHAR(100) | Driver's name |
| Column | Type | Description |
|---|---|---|
| ride_idPK | INT | Unique ride identifier |
| driver_id | INT | Driver assigned to the ride |
| earnings | NUMERIC(10,2) | Driver earnings for the ride |
| status | VARCHAR(20) | Ride status |