AVG

functionsupportedCore SQL functions

docs.snowflake.com ↗

Aggregate functionsWindow functionsData metric functions

Returns the average of non-NULL records. If all records inside a group are NULL, the function returns NULL.

Syntax

supportedpartialnot supportednot scored

Aggregate function

AVG( [ DISTINCT ] <expr1> )

Window function

AVG( [ DISTINCT ] <expr1> ) OVER (
                                 [ PARTITION BY <expr2> ]
                                 [ ORDER BY <expr3> [ { ASC | DESC } ] [ NULLS { FIRST | LAST } ] [ <window_frame> ] ]
                                 )

Parameters

NameRequiredDescription
expr1requiredThis is an expression that evaluates to a numeric data type (INTEGER, FLOAT, DECIMAL, etc.).
expr2requiredThis is the optional expression to partition by.
expr3requiredThis is the optional expression to order by within each partition.

Usage notes

Referenced by