Aggregate functions
Aggregate functions compute a single result from a set of rows.COUNT
Counts rows or non-null values. UseCOUNT(1) for total row counts and COUNT(column) for counting non-null values.
APPROX_COUNT_DISTINCT
Returns the approximate number of distinct values in a column. Faster and cheaper thanCOUNT(DISTINCT ...), and returns exact results for low-cardinality columns. Use this instead of COUNT(DISTINCT ...) unless your query requires a guaranteed exact count.
SUM
Returns the sum of values.AVG
Returns the average of values.MIN / MAX
Returns the minimum or maximum value.STDDEV_POP / STDDEV_SAMP
Returns population or sample standard deviation.VAR_POP / VAR_SAMP
Returns population or sample variance.ARRAY_AGG
Aggregates values into an array.STRING_AGG
Concatenates values into a delimited string.PERCENTILE_CONT
Returns a percentile value using continuous distribution.Related content
Window Functions
Ranking and analytics
Numeric Functions
Math and rounding
All Functions
Browse all function categories
SELECT
GROUP BY and HAVING clauses

