ARRAY_SUM
Sums the numeric elements in an array. NULL items are skipped, and non-numeric values raise an error.
Syntax
ARRAY_SUM(<array>)
Return Type
Numeric (matches the widest numeric type in the array).
Examples
SELECT ARRAY_SUM([1, 2, 3, 4]) AS total;
┌───────┐
│ total │
├───────┤
│ 10 │
└───────┘
SELECT ARRAY_SUM([1.5, 2.25, 3.0]) AS total;
┌────────┐
│ total │
├────────┤
│ 6.75 │
└────────┘
SELECT ARRAY_SUM([10, NULL, -3]) AS total;
┌───────┐
│ total │
├───────┤
│ 7 │
└───────┘