Your question is Top Driver Earnings Per Hour. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
RideNow wants to identify its highest-efficiency drivers based on earnings per hour in the previous calendar month. Write a SQL query to return the drivers whose earnings per hour place them in the top 10% for that period.
fare_amount0 or NULL.driver_id, driver_name, total_earnings, total_hours, and earnings_per_hour, ordered by earnings_per_hour descending.| Column | Type | Description |
|---|---|---|
| driver_idPK | INT | Unique identifier for each driver |
| driver_name | VARCHAR(100) | Driver full name |
| city | VARCHAR(50) | Driver's primary city |
| active_status | VARCHAR(20) | Current status of the driver |
| Column | Type | Description |
|---|---|---|
| trip_idPK | INT | Unique identifier for each trip |
| driver_id | INT | Driver assigned to the trip |
| trip_status | VARCHAR(20) | Trip completion status |
| started_at | TIMESTAMP | Trip start timestamp |
| ended_at | TIMESTAMP | Trip end timestamp |
| fare_amount | DECIMAL(10,2) | Fare earned from the trip |