Reported October 2026
Boston Consulting Group

Summarize Taxi Drivers and Rides

Reported by candidates from Boston Consulting Group's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Boston Consulting Group OA. Under 2s to a working solution.
Founder's read

Boston Consulting Group reported this SQL question in October 2026, and it looks friendlier than it is. One drivers table, four ride tables, one output row with three numbers. If your OA invite lands in the next day or two, the whole thing comes down to aggregating correctly and not mangling the ratios. It's a UNION ALL plus conditional aggregation problem, nothing exotic. If you blank on the integer division gotcha mid-assessment, StealthCoder runs invisibly as a safety net and hands you the query.

The problem

Analyze the provided taxi-driver and ride data, compute summary statistics, and save the result.
FastPrep practice interpretation
For this exercise, assume the input contains 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; the returned table is the runnable practice equivalent of the source-reported saved result file.

Tables
drivers: driver_id PK (Integer), age (Integer), second_language (Text), rating (Decimal)
rides_1: ride_id PK (Integer), driver_id (Integer), status (Text)
rides_2: ride_id PK (Integer), driver_id (Integer), status (Text)
rides_3: ride_id PK (Integer), driver_id (Integer), status (Text)
rides_4: ride_id PK (Integer), driver_id (Integer), status (Text)

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.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The constraint that kills brute force is the four-way split. Don't join each rides table to drivers separately and stitch results together. Stack them once with UNION ALL (not UNION, which dedupes and can silently drop rows). Then compute each metric in its own scalar subquery or CTE and cross join them into one row. The average is AVG(rating) from drivers. The language ratio is SUM(CASE WHEN second_language <> 'no' THEN 1 ELSE 0 END) divided by COUNT(*). The ride ratio is the same idea on status = 'Success'. The pitfall is integer division. Cast to a decimal or multiply by 1.0 first, or you'll get 0 everywhere. Also watch NULL second_language: <> 'no' skips NULLs, so decide whether they count. The spec says 'not exactly no', so handle it explicitly. StealthCoder is your hedge if the live OA makes you second-guess the casting.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Summarize Taxi Drivers and Rides cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Boston Consulting Group's OA.

Boston Consulting Group reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Summarize Taxi Drivers and Rides FAQ

What's the trick in the Boston Consulting Group taxi summary question?+

Stack rides_1 through rides_4 with UNION ALL, then use conditional aggregation for the success ratio. Compute the driver metrics separately from drivers and combine the three scalars into one row. The trick is avoiding integer division and avoiding UNION, which removes duplicate rows.

Why does my ratio come back as 0?+

Your database is doing integer division. Count divided by count truncates to 0 when the result is below 1. Multiply the numerator by 1.0 or CAST it to a decimal or float before dividing. This is the most common mistake on ratio queries like this one.

How should I handle NULL in second_language?+

The spec says count drivers whose second_language is not exactly 'no'. A plain <> 'no' ignores NULLs in a CASE and sends them to ELSE. If NULLs could exist, write the condition explicitly, like second_language IS NULL OR second_language <> 'no', and match what the statement implies.

Do I need joins at all?+

Not really. Every ratio is computed from a single table or the stacked rides set. The constraint that every ride references a valid driver means you don't need to join to filter anything. Skip the joins and keep the query simple and fast.

How do I prepare for this in 48 hours?+

Practice three things: UNION ALL across partitioned tables, SUM(CASE WHEN...) conditional counts, and casting for decimal division. Write this exact query twice from memory. Then check that it returns exactly one row with columns in the stated order.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Boston Consulting Group.

OA at Boston Consulting Group?
Invisible during screen share
Get it