SUM function in Amazon QLDB - Amazon Quantum Ledger Database (Amazon QLDB)

SUM function in Amazon QLDB

Important

End of support notice: Existing customers will be able to use Amazon QLDB until end of support on 07/31/2025. For more details, see Migrate an Amazon QLDB Ledger to Amazon Aurora PostgreSQL.

In Amazon QLDB, use the SUM function to return the sum of the input field or expression values. This function works with numeric values and ignores null or missing values.

Syntax

SUM ( expression )

Arguments

expression

The field name or expression of a numeric data type that the function operates on.

Data types

Supported argument types:

  • int

  • decimal

  • float

Supported return types:

  • int – For integer arguments

  • decimal – For decimal or floating point arguments

Examples

SELECT SUM(r.PendingPenaltyTicketAmount) FROM VehicleRegistration r -- 735.95 SELECT SUM(a) FROM << { 'a' : 1 }, { 'a': 2 }, { 'a': 3 } >> -- 6

Related functions