The following sections describe the aggregate analytic functions that ZetaSQL supports. For an explanation of how analytic functions work, see Analytic Function Concepts. For an explanation of how aggregate analytic functions work, see Aggregate Analytic Function Concepts.
ZetaSQL supports the following aggregate functions as analytic functions:
- ANY_VALUE
- ARRAY_AGG
- AVG
- CORR
- COUNT
- COUNTIF
- COVAR_POP
- COVAR_SAMP
- LOGICAL_AND
- LOGICAL_OR
- MAX
- MIN
- STDDEV_POP
- STDDEV_SAMP
- STRING_AGG
- SUM
- VAR_POP
- VAR_SAMP
OVER
clause requirements:
PARTITION BY
: Optional.ORDER BY
: Optional. Disallowed ifDISTINCT
is present.window_frame_clause
: Optional. Disallowed ifDISTINCT
is present.
Example:
COUNT(*) OVER (ROWS UNBOUNDED PRECEDING)
SUM(DISTINCT x) OVER ()