Aggregate Functions

MySQL aggregate functions are used to return totals, averages, and other statistical information from MySQL. Data is grouped together based on specified columns.

AVG( )

This MySQL function returns the average or mean of a set of numbers given as the argument.

BIT_AND( )

This MySQL function returns the bitwise AND for all bits for the expression given. I'll confess here: I really have no idea what this does, although I wrote something about it. I just don't get these bitwise functions. So please let me know what they do if you know.

BIT_OR( )

This MySQL function returns the bitwise OR for all bits for the expression given. It calculates with a 64-bit precision (BIGINT).

BIT_XOR( )

This MySQL function returns the bitwise XOR (exclusive or) for all bits for the expression given. It calculates with a 64-bit precision (BIGINT).

This MySQL function returns the number of rows retrieved in the SELECT statement for the given column. By default, rows in which the column is NULL are not counted. If the wildcard * is used as the argument, the function counts all rows, including ones with NULL values.

GROUP_CONCAT( )

This MySQL function returns non-NULL values of a group concatenated by a GROUP BY clause, separated by commas.

MAX( )

This MySQL function returns the highest number in the values for a given column.

MIN( )

This MySQL function returns the lowest number in the values for a given column.

STD( )

This MySQL function returns the population standard deviation of the given column.

STDDEV( )

This MySQL function returns the population standard deviation of the given column.

STDDEV_POP( )

This MySQL function returns the population standard deviation of the given column.

STDDEV_SAMP( )

This MySQL function returns the sample standard deviation of the given column.

SUM( )

This MySQL function returns the sum of the values for the given column or expression.

With this MySQL function the variance is determined by taking the difference between each given value and the average of all values given.

VAR_POP( )

This MySQL function returns the variance of a given column, based on the rows selected as a population.

VAR_SAMP( )

This MySQL function returns the variance of a given column, based on the rows selected as a sample of a given population.