SQL aggregate functions take multiple values (from a column in a relation) and return one output.
Functions ignore
NULL
With the exception of
COUNT()
, all the other SQL aggregate functions ignoreNULL
values in a column. If the column only containsNULL
, the function returnsNULL
.
COUNT(col)
: Returns the number of records. It also countsNULL
values, which is something most of the other aggregate functions ignore.AVG(col)
: Returns the average of the columnMIN(), MAX()
: Returns min/maxSUM()
: Sum of values