Sams Teach Yourself SQL in 24 Hours, Third Edition By Ronald R. Plew, Ryan K. Stephens
Table of Contents
Hour 10. Sorting and Grouping Data
Q&A
Q1:
Is using the GROUP BY clause mandatory when using the ORDER BY clause in a SELECT statement?
A1:
No. Using the GROUP BY clause is strictly optional, but it can be very useful when used with ORDER BY.
Q2:
What is a group value?
A2:
Take the CITY column from the EMPLOYEE_TBL. If you select the employee's name and city, and then group the output by city, all the cities that are identical are arranged together.
Q3:
Must a column appear in the SELECT statement to GROUP BY it?
A3:
Yes, a column must be in the SELECT statement to GROUP BY it.