The requests you’ve been working with so far have required answers involving individual column values from the rows returned by the FROM and WHERE clauses. However, you’ll often encounter requests, such as the following, that require only calculated values across multiple rows for an answer.
“How many of our customers live in Seattle?”
“What is the lowest price and highest price we’ve assigned to any item in our inventory?”
“How many classes is Mike Hernandez teaching?”
“What time does our earliest class begin?”
“What is the average length of a class?”
“What is the total amount for order number 12?”
The SQL Standard provides a set of aggregate functions that allow you to calculate a single value from the rows in a result ...