Aggregate functions operate on a group of rows at the same time.
Aggregate functions return one row of output for each group of rows.
For example, computing the average salary of employees and finding the maximum salary of employees.
Aggregate functions are also called group functions because they operate on groups of rows.
The aggregate functions are mainly numerical.
Function | Description |
AVG(x) | Returns the average value of x. |
COUNT(x) | Returns the number of rows returned by a query involving x. |
GLC | Greatest lower bound of an MLSLABEL. |
LUB | Least upper bound of an MLSLABEL. |
MAX(x) | Returns the maximum value of x. |
MEDIAN(x) | Returns the median value of x. |
MIN(x) | Returns the minimum value of x. |
STDDEV(x) | Returns the standard deviation of x. |
SUM(x) | Returns the sum of x. |
VARIANCE(x) | Returns the variance of x. |
Here are some points to remember when using aggregate functions
- COUNT(), MAX(), and MIN() functions operate numbers, strings, and datetimes.
- Null values are ignored by aggregate functions.
- DISTINCT keyword with an aggregate function excludes duplicate entries from the aggregate function's calculation.