Aggregate functions
This topic describes the aggregate functions that are supported and unsupported by PolarDB-X.
Supported functions
The following table describes the aggregate functions that are supported by PolarDB-X.
Function | Description |
---|---|
AVG(expression) | Returns the average value of an expression. The expression is a field. |
COUNT(expression) | Returns the number of records in an expression. The expression is a field or an asterisk (*). |
COUNT(DISTINCT expression) | Returns the number of unique records in an expression. |
MAX(expression) | Returns the maximum value in an expression. |
MIN(expression) | Returns the minimum value in an expression. |
SUM(expression) | Returns the sum of all values in an expression. |
BIT_OR(expression) | Calculates the bitwise OR of an expression. |
BIT_XOR(expression) | Calculates the bitwise exclusive OR (XOR) of an expression. |
BIT_AND(expression) | Calculates the bitwise AND of an expression. |
GROUP_CONCAT(expression) | Returns a concatenated string based on an expression. |
STD() and STDDEV() | Returns the standard deviation of an expression. |
STDDEV_POP() | Calculates the population standard deviation and returns the square root of the population variance. |
STDDEV_SAMP() | Calculates the cumulative sample standard deviation and returns the square root of the sample variance. |