the example they have given (the query was given as well, i didn’t built it myself):
as a solution to the question - “Imagine you’d like to know how many flights there are on average, for all Fridays in a given month from the flights table. First, we’d need to calculate the number of flights per day, and then we’d need to calculate the average based on the daily flight count for each day of the week”
AVG(a.flight_count) AS average_flights
COUNT(*) AS flight_count
GROUP BY 1,2,3
GROUP BY 1,2
ORDER BY 1,2;
I have a few questions about the example:
- what is the meaning of “GROUP BY 1,2,3”? where were these 1,2,3 come from? and how does it effect my set of results? (same quetions about “GROUP BY 1,2
ORDER BY 1,2” at the end of the query)
- after running this example, It seems that the result’s set doesn’t fit what the example was supposed to be about… I’ve got a table with the average num of flight for each day every month instead of the average num for all Fridays in a given months, as they’ve asked…) - is it possible they have been mistaken? or am i getting it all wrong?
thanks a lot!!