Aggregate. Computes the average value of a given set of arguments to identify the central tendency of a value group.
avg ( numeric-expression )
numeric-expression |
A numeric expression for which an average is computed. The expression accepts all datatypes except boolean. The expression will normally reference one or more columns in a group of records such that the average will be computed using the reference column value for each member of the group. |
Compute the average value across a set of rows. The average is computed according to the following formula:
The avg function generates a 0 when a NULL value is received and takes any numeric datatype as input; returns type FLOAT.
The average function could be used to identify things such as the average trading price of a stock over a determined period of time.