Group functions

Group functions are designed to operate on groups of rows. The result of the group is a single value for the whole group.

If you do not specify a function otherwise, all rows are treated as one group.


  • AVG ([DISTINCT | ALL] expr) - mean value expression, NULL is not included
  • COUNT ([DISTINCT | ALL] expr) - number of occurrences of expressions other than NULL, asterisk (*) used in place of the expression will calculate the number of all rows including duplicates and NULL values
  • MAX ([DISTINCT | ALL] expr) - maximum value of the expression
  • MIN ([DISTINCT | ALL] expr) - minimum value of the expression
  • StdDev ([DISTINCT | ALL] expr) - standard deviation terms, without regard to NULL values
  • SUM ([DISTINCT | ALL] expr) - the sum of expressions, without regard to NULL values
  • VARIANCE ([DISTINCT | ALL] expr) - variance expressions, without regard to NULL values


DISTINCT qualifier restricts the function block for different values ​​of the arguments.
ALL qualifier is the default - group functions do not eliminate duplicates.
The arguments are the number of group functions and for functions MAX, MIN, and COUNT as the dates, characters and strings.
All functions block, except for COUNT (*) ignore NULL values

No comments: