Aggregate Functions
Aggregate functions operate on multiple sets of values and return a single value.
AVG( <expr> )
Returns the arithmetic mean of all input values.
COUNT( <expr> )
Returns the number of rows in an input value.
DISTINCT( <expr> )
Returns the number of distinct values in a given column.
MAX( <expr> )
Returns the maximum value of all input values.
MIN( <expr> )
Returns the minimum value of all input values.
SUM( <expr> )
Returns the arithmetic sum of all input values.
ARBITRARY / ANY_VALUE( <expr> )
Returns random value from set of values
LISTAGG( [distinct] <column> [, <delimiter>]) [within group (order by <column> ) )
Concatenates the input values together, with each value separated by the specified delimiter string.
Support datatype: String or data type that is cast to string
Usages:
This function returns a single string comprising all non-NULL input values
If we didn’t provide WITHIN GROUP (ORDER BY) then the result will be unpredictable
We support exact column name in the order by of
within group(order by <column>)
we dont support ordinals in the order byWe don’t support
over()
clause with listagg.If delimiter is not provided then default value is
,
.
STRING_AGG( [distinct] <column> [, <delimiter>]) order by <column> limit <value> )
Concatenates the input values together, with each value separated by the specified delimiter string.
Support datatype: String or data type that is cast to string
Usages:
This function returns a single string comprising all non-NULL input values
If we didn’t provide
ORDER BY <column>
then the result will be unpredictableWe support exact column name in the order by of
ORDER BY <column>
we don't support ordinals in the order byWe don’t support
over()
clause with string.If delimiter is not provided then default value is
-
.
COUNT(DISTINCT( <expr> ))
Returns distinct count of first projection used in the query
Last updated