The aggregation functions of the database compute a return value from a series of values. The table below lists some built-in aggregation functions.
Function | Parameter Type | Return Type | Description |
avg(expression) | All numeric types | Numeric type | Average value |
bit_and(expression) | smallint, int, bigint, bit | Same as parameter type | Bitwise AND of all non-null values |
bit_or(expression) | smallint, int, bigint, bit | Same as parameter type | Bitwise OR of all non-null values |
bool_and(expression) | bool | bool | Returns true if all values are true, otherwise returns false |
bool_or(expression) | bool | bool | Returns true if at least one value is true, otherwise returns false |
count(*) | - | bigint | Number of returned rows |
count(expression) | any | bigint | Returns the sum of all values where the expression is non-null |
every(expression) | bool | bool | Same as bool_and |
max(expression) | array,numeric,string, date/time type | Same as parameter type | Maximum value in input parameters |
min(expression) | array, numeric, string, date/time type | Same as parameter type | Minimum value in input parameters |
sum(expression) | smallint, int, bigint, real, double precision,numeric, interval | - | Sum of all input parameters |