How does GROUP BY arrange cells with numeric values?


#1


Hi everyone, this is maybe more of a general question, but it fits pretty good inside this exercise.
I have to calculate the average flight distance per day of the week and month and I have no idea how to go about this for some reason.

My first Idea (ignoring the example given) was to just select day of the week and the flight length and GROUP it by day of the week. However it did not work as I expected, because in my mind the only way for SQL to GROUP the flight lengths with some sense would be to sum them up or just provide an average. However the number which shows up next to the days of the week seems to be neither of it.

So I wonder. If i have two columns, one with text and the other with INTEGERS and I choose to let SQL GROUP those columns by the one with the text (like with days of the week) how does SQL then group the numeric values accordingly?



SELECT

dep_day_of_week,
distance

FROM

flights

GROUP BY

dep_day_of_week;


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.