A simple aggregate will return a single value for the entire table. Although a small number of requirements can be satisfied by simply aggregating all rows within a table, many aggregation questions need to roll up data into analysis buckets, such as sales by month or defects by product line. The GROUP BY clause allows you to define the columns that are used to compute aggregate values.
The most common aggregate functions are:
COUNT. number of items
MIN. minimum value
MAX. maximum value
AVG. average value
SUM. total of all values
The following query returns the number of employees who hold a particular job title.
SELECT JobTitle, count(*) FROM HumanResources.Employee GROUP BY JobTitle