In many cases, we want to apply Aggregate Functions (SQL) to subgroups of tuples in a relation, each subgroup of tuples consists of the set of tuples that have the same value for the grouping attributes.

We can use the GROUP BY clause for specifying the grouping attributes, which must also appear in the SELECT clause:

SELECT   <attr list>
FROM     <table>
[WHERE   <cond>]
GROUP BY <grouping attr>