SUM

Returns the sum of non-NULL input expressions.

Syntax

SUM(column_name number or interval) → same as input

  • column_name: The column containing the values to sum.

Examples

Aggregate function example
SELECT SUM(base_fee_per_gas) 
FROM eth.recent_blocks
-- 9.858134477692287E8
Window function example
SELECT "base_fee_per_gas", "gas_used", SUM("total_gas_used") 
OVER (PARTITION BY "base_fee_per_gas") as "sum_gas_used" 
FROM eth.recent_blocks 
LIMIT 1
-- base_fee_per_gas, gas_used, sum_gas_used
-- -51.0, -4.0, -56.0

Last updated