Aggregation & GROUP BY
Exercise · SQL & Querying

Predict, then run it

Predict the output

rides(pilot, passengers) = (ana,4),(ana,2),(bo,1). Pilots whose total passengers exceed 3 — the aggregate filter belongs in HAVING:

SELECT pilot, SUM(passengers) AS total FROM rides GROUP BY pilot HAVING SUM(passengers) > 3 ORDER BY pilot;

Predict the exact output.