Grouping
Grouping#
The GROUP BY clause comes after the FROM clause of the SELECT statement. In case a statement contains a WHERE clause, the GROUP BY clause must come after the WHERE clause.
Following the GROUP BY clause is a column or a list of comma-separated columns used to specify the group. 3
如果两个primary key values指向同一非primary key值,grouping之后重复的非primary key值只会出现一次:

GROUP BY OFFICE之后:

Example:#

Which ORDERS are invoiced for a quantity of 20000 or more items?
How many items are in each order?