Some queries examine aspects of the data in your table that reflect properties of groups of rows rather than of individual rows. For example, you may want to find the average amount of money that a customer pays for an order, or to see how many employees work for each department. For these types of tasks, you use aggregate functions and the GROUP BY clause.
A first look at aggregate functions
Applying aggregate functions to grouped data