RienSQL
TASK #213 · Easy · Cabify

Surge-Priced Rides

Your brief
At times of high demand Cabify raises prices: such rides in the rides table have a surge_multiplier greater than 1 (1.00 means the regular price).

Write a query that for every city returns city, surge_rides (the number of completed surge-priced rides, status = 'completed') and avg_surge_fare (the average fare_eur of those rides, rounded to two decimals). Do not show cities without such rides.
Expected columnscity surge_rides avg_surge_fareCabify
SQL editor
SQLite
Ctrl / ⌘ + ↵
Result

Write a query and run it to see the results.

Schema
driversdriver_id, driver_name, city, car_model
driver_shiftsshift_id, driver_id, shift_start, shift_end
ridesride_id, driver_id, city, requested_at, status, started_at, ended_at, distance_km, surge_multiplier, fare_eur