BAD_Analytics/SQL files/5.sql

9 lines
303 B
MySQL
Raw Normal View History

2019-05-13 17:47:18 +02:00
SELECT F1.carrier,
(SELECT AVG(F2.arr_delay)
FROM Flight_delays F2
WHERE F1.carrier = F2.carrier
GROUP BY F2.carrier) AS 'avg_delay'
FROM Flight_delays F1
WHERE F1.origin_city_name LIKE 'San Francisco%'
GROUP BY F1.carrier
ORDER BY avg_delay ASC;