SUM is an aggregate function that evaluates the sum of the
expression over a set of rows (see
The DISTINCT and ALL qualifiers eliminate or retain duplicates. ALL is assumed if neither ALL nor DISTINCT is specified. For example, if a column contains the values 1, 1, 1, 1, and 2, SUM(col) returns a greater value than SUM(DISTINCT col).
Only one DISTINCT aggregate expression per
The Expression can contain multiple column references or expressions, but it cannot contain another aggregate or subquery. It must evaluate to a built-in numeric data type. If an expression evaluates to NULL, the aggregate skips that value.
The resulting data type is the same as the expression on which it operates (it might overflow).