Hi, I don’t understand why we use a non correlated subquery to calculate the average distance flown per day each month.
In 2003-10, Monday it says the average distance flown is 4301, however if we look at all flights flown in 2003-10 on a Monday, it says the distances flown are: 3711 and 590. Therefore isn’t the average distance flown on a Monday (3711+590)/2 = 2150.5? 4301 appears to be the total distance flown?
I used the following query to work out the averages instead:
SELECT dep_month, dep_day_of_week, sum(distance) / count(id) AS average_distance FROM flights GROUP BY 1,2 ORDER BY 1,2;
Is this query right or am I completely misunderstanding the question?