DDSQL Aggregation Functions

Join the Beta!

DDSQL is in private beta.

Request Access

Aggregation functions

Aggregate functions compute a single result from a set of input values, usually used in conjunction with a GROUP BY statement.

avg

NameArgument TypesReturn typeDescription
avg(expr e)numericnumericComputes the average (arithmetic mean) of all the non-null input values.

max

NameArgument TypesReturn typeDescription
max(expr e)variablevariableComputes the maximum of the non-null input values. Types of input values must be comparable.

min

NameArgument TypesReturn typeDescription
min(expr e)variablevariableComputes the minimum of the non-null input values. Types of input values must be comparable.

sum

NameArgument TypesReturn typeDescription
sum(expr e)numericnumericComputes the sum of the non-null input values.

count

NameArgument TypesReturn typeDescription
count(expr e)numericintegerComputes the number of input rows in which the input value is not null.
count(distinct expr e1, e2 …)integerComputes the number of input values in which the input value is not null.
count(*)integerComputes the number of input rows.

string_agg

NameArgument TypesReturn typeDescription
string_agg(expr e, delimiter e)string, stringstringConcatenates the input values, seperated by a delimiter.

array_agg

NameArgument TypesReturn typeDescription
string_agg(expr e)variablearrayConcatenates the input values into an array.
PREVIEWING: evan.li/clarify-agentless