AVG function [Aggregate]

Function

Computes the average of a numeric expression for a set of rows, or computes the average of a set of unique values.

Syntax

AVGnumeric-expression  | DISTINCT column-name )

Parameters

numeric-expression The value whose average is calculated over a set of rows.

DISTINCT column-name Computes the average of the unique values in column-name. This is of limited usefulness, but is included for completeness.

Example

The following statement returns the value 49988.6:

SELECT AVG ( salary ) FROM Employees

Usage

This average does not include rows where numeric -expression is the NULL value. Returns the NULL value for a group containing no rows.

Standards and compatibility

See also

“COUNT function [Aggregate]”

“SUM function [Aggregate]”

Chapter 2, “Using OLAP” in the System Administration Guide: Volume 2