Database · Easy
How does GROUP BY work? What are the rules for columns in the SELECT list?
DatabaseSQLFresher
Answer preview
GROUP BY collapses rows that share the same values in the grouping columns into one row per distinct combination, and aggregate functions then summarise each group. Every column in the SELECT list must therefore be either a grouping column or wrapped in an aggregate.…