Aggregate functions

更新时间:
复制 MD 格式

PolarDB-X supports the following aggregate functions.

Supported functions

FunctionDescription
AVG(expression)Returns the average value of the expression. The expression is a field.
COUNT(expression)Returns the number of records in the expression. The expression can be a field or an asterisk (*).
COUNT(DISTINCT expression)Returns the number of unique records in the expression.
MAX(expression)Returns the maximum value in the expression.
MIN(expression)Returns the minimum value in the expression.
SUM(expression)Returns the sum of all values in the expression.
BIT_OR(expression)Returns the bitwise OR of all values in the expression.
BIT_XOR(expression)Returns the bitwise exclusive OR (XOR) of all values in the expression.
BIT_AND(expression)Returns the bitwise AND of all values in the expression.
GROUP_CONCAT(expression)Returns a concatenated string based on the expression.
STD(expression) and STDDEV(expression)Returns the standard deviation of the expression.
STDDEV_POP(expression)Calculates the population standard deviation and returns the square root of the population variance.
STDDEV_SAMP(expression)Calculates the cumulative sample standard deviation and returns the square root of the sample variance.