Aggregate functions summarize data over a group of rows from the database. The groups are formed using the GROUP BY clause of the SELECT statement. Aggregate functions are only allowed in the select list and in the HAVING and ORDER BY clauses of a SELECT statement.
The aggregate functions AVG, SUM, STDDEV, and VARIANCE do not support the binary data types (BINARY and VARBINARY).
Table 5-1 lists all aggregate functions and their parameters.
Aggregate function |
Parameters |
---|---|
AVG |
( { DISTINCTcolumn-name | numeric-expr } ) |
COUNT |
( * ) |
COUNT |
( { DISTINCTcolumn-name | expression } ) |
MAX |
( { DISTINCTcolumn-name | expression } ) |
MIN |
( { DISTINCTcolumn-name | expression } ) |
STDDEV |
( [ ALL ] expression ) |
SUM |
( { DISTINCTcolumn-name | expression } ) |
VARIANCE |
( [ ALL ] expression ) |