Summarize Taxi Drivers and Rides
Problem statement
You are given one drivers table and four ride partitions named rides_1 through rides_4. Return a one-row summary with exactly these columns:
average_rating: the arithmetic mean ofratingacross all drivers.second_language_ratio: the number of drivers whosesecond_languageis not exactly"no", divided by the total number of drivers.successful_ride_ratio: the number of rides whosestatusis exactly"Success", divided by the number of rides across all four partitions.
Return the columns in the listed order.
Table schema
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
drivers
Taxi-driver attributes used for the driver-level summary.
| Column | Type | Nullable | Description |
|---|---|---|---|
| driver_idPK | Integer | No | — |
| age | Integer | No | — |
| second_language | Text | No | — |
| rating | Decimal | No | — |
rides_1
Ride partition 1.
| Column | Type | Nullable | Description |
|---|---|---|---|
| ride_idPK | Integer | No | — |
| driver_id | Integer | No | — |
| status | Text | No | — |
Foreign key: driver_id → drivers(driver_id)
rides_2
Ride partition 2.
| Column | Type | Nullable | Description |
|---|---|---|---|
| ride_idPK | Integer | No | — |
| driver_id | Integer | No | — |
| status | Text | No | — |
Foreign key: driver_id → drivers(driver_id)
rides_3
Ride partition 3.
| Column | Type | Nullable | Description |
|---|---|---|---|
| ride_idPK | Integer | No | — |
| driver_id | Integer | No | — |
| status | Text | No | — |
Foreign key: driver_id → drivers(driver_id)
rides_4
Ride partition 4.
| Column | Type | Nullable | Description |
|---|---|---|---|
| ride_idPK | Integer | No | — |
| driver_id | Integer | No | — |
| status | Text | No | — |
Foreign key: driver_id → drivers(driver_id)
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| average_rating | Decimal | No | — |
| second_language_ratio | Decimal | No | — |
| successful_ride_ratio | Decimal | No | — |
Row order: must match exactly. Numeric tolerance: 1e-9.
Constraints
driverscontains at least one row.- At least one ride exists across
rides_1,rides_2,rides_3, andrides_4. - Every ride references a driver present in
drivers. - Each
ratingis finite. - Ratios are values between
0and1, inclusive.
Source note: The screenshot is a prompt-only crop of the reported assessment description; solution commentary is not shown.