Book Contents

Book Index

Next Topic

Home

SUM

SUM computes the sum 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

SUM ( [ 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

Notes