Menu

Completed rides by city

Grab's operations team wants to know how many completed rides happened in each city.

From the rides table, return the city and the number of completed rides (status = 'completed') as completed_rides, for every city that has at least one completed ride.

Schema

rides
idINT
cityTEXT
statusTEXT
fareNUMERIC(8,2)

Example input

rides
↑ Read the question

The interviewer's next question

Ops now cares about revenue, not ride count: return each city's total completed-ride fare as completed_revenue, but only for cities where that total exceeds RM 20. Order by city.

Solving follow-ups — the questions an interviewer actually asks next — unlocks with a Basic plan.

See Basic plans

RM 25/mo · cancel anytime

Alongside the completed-ride count, show the average fare per completed ride for each city, rounded to 2 decimal places, as avg_fare.

Solving follow-ups — the questions an interviewer actually asks next — unlocks with a Basic plan.

See Basic plans

RM 25/mo · cancel anytime

Keep going

Company names are trademarks of their respective owners, used here only to describe practice material. mahir_data is not affiliated with, endorsed by, or sponsored by any company named on this site. Terms.