Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

SUM

Syntax

SUM ( { [ALL] expression } | { DISTINCT column_ref } )

Description

The aggregate function SUM returns the sum of the values in a group. The keyword DISTINCT specifies that the duplicate values are to be eliminated before computing the sum.

  • The argument column_ref or expression can be of any numeric type.
  • The result of the function is of the same data type as that of the argument except that the result is of type INTEGER when the argument is of type SMALLINT or TINYINT.
  • The result can have a null value.

Example

SELECT SUM (amount)

FROM orders

WHERE order_date = SYSDATE ;

TOCIndex