Also known as summary functions, the following are intended for use with GROUP BY clauses, where they will produce values based on the set of records making up each row of the final result set.
If used without a GROUP BY clause, these functions will cause the result set to be displayed as a single row, with a value calculated based on all of the rows of the complete result set. Without a GROUP BY clause, mixing these functions with columns that do not contain summary functions will cause an error, because you cannot collapse those columns into a single row and get a sensible value.
This function returns a count of the number of times in the ungrouped result set that expr had a non-NULL value. If COUNT(*) is used, it will simply provide a count of the number of rows in the group, irrespective of NULL values. |
||
This function returns a count of the number of different non-NULL values (or sets of values, if multiple expressions are provided). |
||
This function calculates the arithmetic mean (average) of the values appearing in the rows of the group. |
||
This function returns the smallest or largest value of expr in the rows of the group. |
||
This function returns the sum of the values for expr in the rows of the group. |
||
This function returns the standard deviation of the values for expr in the rows of the group (either of the two function names may be used). |
||
This function calculates the bit-wise OR and the bit-wise AND of the values for expr in the rows of the group, respectively. |