Aggregate Functions

An aggregate function refers to a set of input values and returns one single result value. If the table is subdivided into several groups with the GROUP BY clause, an aggregate function calculates a value for each of these groups.

If a GROUP BY clause is not stated, an aggregate function always refers to the entire table. This type of query then returns exactly one result row. Aggregate functions are sometimes referred to as set functions.

The following is a list of aggregate functions:

ANY
APPROXIMATE_COUNT_DISTINCT
AVG
CORR
COUNT
COVAR_POP
COVAR_SAMP
EVERY
FIRST_VALUE
GROUP_CONCAT
GROUPING[_ID]
LAST_VALUE
LISTAGG
MAX
MEDIAN
MIN

REGR_FUNCTIONS
SOME
ST_INTERSECTION (Refer to ST_* and Geospatial Data sections for more information)
ST_UNION (Refer to ST_* and Geospatial Data sections for more information)
STDDEV
STDDEV_POP
STDDEV_SAMP
SUM
VAR_POP
VAR_SAMP
VARIANCE