Aggregate Functions
General-Purpose Aggregate Functions
Function | Return Type | Description |
avg(expression) | numeric for any integer type argument, double precision for a floating-point argument, otherwise the same as the argument data type | the average (arithmetic mean) of all input values |
bit_and(expression) | same as argument data type | the bitwise AND of all non-null input values, or null if none |
bit_or(expression) | same as argument data type | the bitwise OR of all non-null input values, or null if none |
bool_and(expression) | bool | true if all input values are true, otherwise false |
bool_or(expression) | bool | true if at least one input value is true, otherwise false |
count(*) | bigint | number of input rows |
count(expression) | bigint | number of input rows for which the value ofexpression is not null |
every(expression) | bool | equivalent to bool_and |
max(expression) | same as argument type | maximum value of expression across all input values |
min(expression) | same as argument type | minimum value of expression across all input values |
sum(expression) | bigint for smallint or int arguments, numeric for bigint arguments, double precision for floating-point arguments, otherwise the same as the argument data type | sum of expression across all input values |