My lecturer stated:
All column names in SELECT list must appear in GROUP BY clause unless name is used only in an aggregate function
I\'m ju
There are exceptions as noted by Sam Saffron but generally what your lecturer said is true.
If I select 3 columns and group by 2 what should the RDBMS do with the 3rd column?
The developers of the RDBMS may make a decision of how to handle the extra colum (as it appears MySQL's developers have) but is it the decision I would have made or the one I want when writing the select? Will the decision always be valid? I certainly prefer the Oracle-like approach of forcing me to explicitly state what should happen.
If I select 3 columns and group by 2 should the RDBS group by all 3, pick a random value from the 3rd, the biggest or littlest, the most common?