Book Contents

Book Index

Next Topic

Home

AVG

AVG computes the average (arithmetic mean) of an expression over a group of rows. It returns a DOUBLE PRECISION value for a floating-point expression. Otherwise, the return value is the same as the expression data type.

Syntax

AVG ( [ ALL | DISTINCT ] expression )

Semantics

 

ALL

invokes the aggregate function for all rows in the group (default)

DISTINCT

invokes the aggregate function for all distinct non-null values of the expression found in the group

expression

(INTEGER, BIGINT, DOUBLE PRECISION, or INTERVAL) contains at least one column reference