Aggregate Functions

An aggregate function performs a calculation operation on a set of input values and returns a value. For example, the COUNT function counts the number of rows retrieved by an SQL statement. Table 1 lists aggregate functions.

Table 1 Aggregate functions

Function

Returned Data Type

Description

COUNT(value [, value]* )

DOUBLE

Returns count of values that are not null.

COUNT(*)

BIGINT

Returns count of tuples.

AVG(numeric)

DOUBLE

Returns the average (arithmetic mean) of all input values.

SUM(numeric)

DOUBLE

Returns the sum of all input numerical values.

MAX(value)

DOUBLE

Returns the maximum value among all input values.

MIN(value)

DOUBLE

Returns the minimum value among all input values.

STDDEV_POP(value)

DOUBLE

Returns the population standard deviation of all numeric fields of all input values.

STDDEV_SAMP(value)

DOUBLE

Returns the sample standard deviation of all numeric fields of all input values.

VAR_POP(value)

DOUBLE

Returns the population variance (square of population standard deviation) of numeral fields of all input values.

VAR_SAMP(value)

DOUBLE

Returns the sample variance (square of the sample standard deviation) of numeric fields of all input values.

Precautions

None

Example

None