BAD_Analytics/SQL files/4.sql
2019-05-13 17:47:18 +02:00

12 lines
479 B
SQL

SELECT CASE WHEN day_of_week = 1 THEN 'Monday'
WHEN day_of_week = 2 THEN 'Tuesday'
WHEN day_of_week = 3 THEN 'Wednesday'
WHEN day_of_week = 4 THEN 'Thursday'
WHEN day_of_week = 5 THEN 'Friday'
WHEN day_of_week = 6 THEN 'Saturday'
WHEN day_of_week = 7 THEN 'Sunday'
END AS 'day_of_week',
AVG(arr_delay)
FROM Flight_delays
GROUP BY day_of_week
ORDER BY AVG(arr_delay) DESC;