AVG is an aggregate function that evaluates the average of an
expression over a set of rows (see
Only one DISTINCT aggregate expression per
The expression can contain multiple column references or expressions, but it cannot contain another aggregate or subquery. It must evaluate to an SQL-92 numeric data type. You can therefore call methods that evaluate to SQL-92 data types. If an expression evaluates to NULL, the aggregate skips that value.
The resulting data type is the same as
the expression on which it operates (it will never overflow). The following
query, for example, returns the INTEGER 1, which might not be what
you would expect:
CAST
the expression to another data type if you want more precision: