ARRAY_SUM
Returns the sum of elements of <array>
.
Syntax
ARRAY_SUM(<array>)
Parameters
Parameter | Description | Supported input types |
---|---|---|
<array> | The array to be used to calculate the function. | Any array of numeric types |
Return Type
The return type is BIGINT
if the element type of <array>
is INT
and DOUBLE PRECISION
if the element type is REAL
. Otherwise, it matches the element type.
Example
SELECT
ARRAY_SUM([ 4, 1, 3, 2 ]) AS levels;
Returns: 10