Summary
In this chapter, you learned how to calculate the statistical properties of a dataset using aggregate functions, such as the average, count, minimum, maximum, and standard deviation. Aggregate functions themselves are applied to a whole dataset. In order to use them to analyze the statistics of sub-datasets inside a larger dataset, you also learned about the GROUP BY
clause of the SELECT
statement, which divides a large dataset into smaller ones based on the keys you provided and applies aggregate functions to each of the groups.
To make the GROUP BY
clause more useful, several additional properties were introduced, most importantly the HAVING
clause. This HAVING
clause is used to filter the values of aggregated groups. It is applied at the second stage of the GROUP BY
clause execution and should be distinguished from the WHERE
clause, which is applied to the original data table or table set and is applied at the first stage of the GROUP BY
execution.
Now that you learned...