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.

  1. AVG

    The MySQL AVG() function returns the average of all the values ​​represented by the expression.
  2. BIT_AND

    The MySQL BIT_AND() function is an aggregate function that performs a “bitwise AND” operation on all non-null input values.
  3. BIT_OR

    The MySQL BIT_OR() function is an aggregate function that performs a “bitwise OR” of all non-null input values.
  4. BIT_XOR

    The MySQL BIT_XOR() function is an aggregate function that performs a “bitwise XOR” operation on all non-null input values.
  5. COUNT

    The MySQL COUNT() function is used to count the number of non-null values ​​in all values ​​represented by an expression.
  6. GROUP_CONCAT

    The MySQL GROUP_CONCAT() function concatenates the values ​​of the columns or expressions from a group into a string and returns it.
  7. JSON_ARRAYAGG

    The MySQL JSON_ARRAYAGG() function aggregates the values ​​of the specified column or expression into a JSON array.
  8. JSON_OBJECTAGG

    The MySQL JSON_OBJECTAGG() function aggregates key-value pairs with the first parameter as the key and the second parameter as the value into a JSON object.
  9. MAX

    The MySQL MAX() function returns the maximum value among all the values ​​represented by a expression in a group.
  10. MIN

    The MySQL MIN() function returns the minimum value among all the values ​​represented by the expression.
  11. STD

    The MySQL STD() function calculates the population standard deviation of all non-null input values ​​and returns the result.
  12. STDDEV

    The MySQL STDDEV() function calculates the population standard deviation of all non-null input values ​​and returns the result.
  13. STDDEV_POP

    The MySQL STDDEV_POP() function calculates the population standard deviation of all non-null input values ​​and returns the result.
  14. STDDEV_SAMP

    The MySQL STDDEV_SAMP() function calculates the sample standard deviation of all non-null input values ​​and returns the result.
  15. SUM

    The MySQL SUM() function computes the sum of all specified values ​​in a group and returns the result.
  16. VAR_POP

    The MySQL VAR_POP() function computes the population variance (square of the population standard deviation) for all non-null input values ​​and returns the result.
  17. VARIANCE

    The MySQL VARIANCE() function computes the population variance (square of the population standard deviation) for all non-null input values ​​and returns the result.