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.

Get Sams Teach Yourself SQL in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.