Aggregate Functions

Aggregate Functions

Function Name

Description

Example

AVG

Returns the average of the values in a group. Null values are ignored.

SELECT AVG(price) FROM titles

COUNT

Returns the number of items in a group.

SELECT COUNT(*) FROM titles

MAX

Returns the maximum value in the expression.

SELECT MAX(price) FROM titles

MIN

Returns the minimum value in the expression.

SELECT MIN(price) FROM titles

SUM

Returns the sum of all the values in the expression.  Must be used with numeric columns only. Null values are ignored.

SELECT SUM(price) FROM titles

STDEV, STDDEV

Returns the statistical standard deviation of all values in the given expression. Must be used with numeric columns only. Null values are ignored.

SELECT STDEV(price) FROM titles

VAR

Returns the statistical variance of all values in the given expression. Must be used with numeric columns only. Null values are ignored.

SELECT VAR(price) FROM titles