14.3 Aggregate Functions
In SQL, aggregate functions are used to perform a calculation on a set of values and return a single value. These functions can be used to perform various operations, such as calculating the sum, average, maximum, minimum, or count of a set of values. For example, the SUM function can be used to calculate the total of all the values in a column, while the AVG function can be used to calculate the average value of a column.
It is important to note that aggregate functions ignore null values, with the exception of the COUNT function, which includes null values in its calculation. This means that if a column contains null values, the result of an aggregate function that ignores null values may be different from the result of an aggregate function that includes null values. Therefore, it is important to carefully consider which aggregate function to use based on the data in the column.
Let's delve into the commonly used aggregate functions:
1. COUNT(): This...