[Figure: Example of a table derived from GROUP BY clause]
A collection of rows derived from the FROM clause and WHERE clause in the table expression are grouped together.
In this example, the result of the FROM clause is equivalent to the STOCK table because only the STOCK table is
specified in the FROM clause in the table expression. Also, because the WHERE clause is omitted, all rows are
grouped.
GROUP BY clause
Specify a column name as a group key, a data column value function, or a numeric function in the GROUP BY clause.
When a column name is specified, the column is called a grouped column. When a data column value function or
numeric function is specified, the function is called a grouped function. In Example 1, the grouped column is
PRODUCT. The table derived from the results of the GROUP BY clause is a grouped table in which rows having the
same value for the grouped column are formed into one group. When specifying multiple columns as grouped
columns, separate the column names with commas (,). In this case, the rows having the same values for each
grouped column are formed into one group.
72