MySQL Aggregate Functions
MySQL aggregate functions are mainly used for data statistics, such as count, sum, average, etc. Aggregate functions combined with grouping operations allow you to count data in more dimensions.
-
AVG
The MySQLAVG()
function returns the average of all the values represented by the expression. -
BIT_AND
The MySQLBIT_AND()
function is an aggregate function that performs a “bitwise AND” operation on all non-null input values. -
BIT_OR
The MySQLBIT_OR()
function is an aggregate function that performs a “bitwise OR” of all non-null input values. -
BIT_XOR
The MySQLBIT_XOR()
function is an aggregate function that performs a “bitwise XOR” operation on all non-null input values. -
COUNT
The MySQLCOUNT()
function is used to count the number of non-null values in all values represented by an expression. -
GROUP_CONCAT
The MySQLGROUP_CONCAT()
function concatenates the values of the columns or expressions from a group into a string and returns it. -
JSON_ARRAYAGG
The MySQLJSON_ARRAYAGG()
function aggregates the values of the specified column or expression into a JSON array. -
JSON_OBJECTAGG
The MySQLJSON_OBJECTAGG()
function aggregates key-value pairs with the first parameter as the key and the second parameter as the value into a JSON object. -
MAX
The MySQLMAX()
function returns the maximum value among all the values represented by a expression in a group. -
MIN
The MySQLMIN()
function returns the minimum value among all the values represented by the expression. -
STD
The MySQLSTD()
function calculates the population standard deviation of all non-null input values and returns the result. -
STDDEV
The MySQLSTDDEV()
function calculates the population standard deviation of all non-null input values and returns the result. -
STDDEV_POP
The MySQLSTDDEV_POP()
function calculates the population standard deviation of all non-null input values and returns the result. -
STDDEV_SAMP
The MySQLSTDDEV_SAMP()
function calculates the sample standard deviation of all non-null input values and returns the result. -
SUM
The MySQLSUM()
function computes the sum of all specified values in a group and returns the result. -
VAR_POP
The MySQLVAR_POP()
function computes the population variance (square of the population standard deviation) for all non-null input values and returns the result. -
VARIANCE
The MySQLVARIANCE()
function computes the population variance (square of the population standard deviation) for all non-null input values and returns the result.