sum

This function is used to calculate the total sum.

Syntax

sum(col), 
sum(DISTINCT col)

Parameters

Table 1 Parameter

Parameter

Mandatory

Description

col

Yes

The value can be of any data type and can be converted to the DOUBLE type for calculation.

The value can be of the DOUBLE, DECIMAL, or BIGINT type.

If the value is of the STRING type, the system implicitly converts it to DOUBLE for calculation.

Return Values

The return value is of the DOUBLE type.

If the value of col is NULL, the row is not involved in calculation.

Example Code