Explain how you use SQL to solve data problems, including any examples of complex aggregations or joins you’ve implemented.
For this exercise, demonstrate the aggregation portion with the supplied trip_records table. Calculate completed-trip metrics by driver and handle excluded statuses and missing fares explicitly.
driver_name, completed_trips, total_fare, and average_farecompletedtotal_fare descending, then driver_name ascending| Column | Type | Description |
|---|---|---|
| trip_idPK | INT | Unique trip identifier |
| driver_name | VARCHAR(100) | Name of the driver associated with the trip |
| status | VARCHAR(20) | Trip completion status |
| fare | DECIMAL(10,2) | Fare recorded for the trip |
| trip_date | DATE | Date on which the trip occurred |