FastPrepSummarize Taxi Drivers and Rides
Problem · Database

Summarize Taxi Drivers and Rides

EasyCapital One logoCapital OneNEW GRADOA

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 of rating across all drivers.
  • second_language_ratio: the number of drivers whose second_language is not exactly "no", divided by the total number of drivers.
  • successful_ride_ratio: the number of rides whose status is exactly "Success", divided by the number of rides across all four partitions.

Return the columns in the listed order.

Table schema

Pandas

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.

ColumnTypeNullableDescription
driver_idPKIntegerNo
ageIntegerNo
second_languageTextNo
ratingDecimalNo

rides_1

Ride partition 1.

ColumnTypeNullableDescription
ride_idPKIntegerNo
driver_idIntegerNo
statusTextNo

Foreign key: driver_id drivers(driver_id)

rides_2

Ride partition 2.

ColumnTypeNullableDescription
ride_idPKIntegerNo
driver_idIntegerNo
statusTextNo

Foreign key: driver_id drivers(driver_id)

rides_3

Ride partition 3.

ColumnTypeNullableDescription
ride_idPKIntegerNo
driver_idIntegerNo
statusTextNo

Foreign key: driver_id drivers(driver_id)

rides_4

Ride partition 4.

ColumnTypeNullableDescription
ride_idPKIntegerNo
driver_idIntegerNo
statusTextNo

Foreign key: driver_id drivers(driver_id)

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
average_ratingDecimalNo
second_language_ratioDecimalNo
successful_ride_ratioDecimalNo

Row order: must match exactly. Numeric tolerance: 1e-9.

Constraints

  • drivers contains at least one row.
  • At least one ride exists across rides_1, rides_2, rides_3, and rides_4.
  • Every ride references a driver present in drivers.
  • Each rating is finite.
  • Ratios are values between 0 and 1, inclusive.

Source note: The screenshot is a prompt-only crop of the reported assessment description; solution commentary is not shown.

More Capital One problems