Chapter 6. Summarizing and Grouping Data
The preceding chapter described scalar functions, which operate on individual row values. This chapter introduces SQL's aggregate functions, or set functions, which operate on a group of values to produce a single, summarizing value. You apply an aggregate to a set of rows, which can be:
All the rows in a table
Only those rows specified by a
Those rows created by a
GROUP BY clause, which groups rows, often is used with a
HAVING clause, which filters groups. No matter how many rows the input set contains, an aggregate function returns a single statistic: a sum, minimum, or average, for example.
The main difference between queries with and without aggregate functions is that nonaggregate ...