AVG 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 AVG
function to return the average (arithmetic
mean) of the input expression values. This function works with numeric values and
ignores null or missing values.
Syntax
AVG (
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
Return type: decimal
Examples
SELECT AVG(r.PendingPenaltyTicketAmount) FROM VehicleRegistration r -- 147.19 SELECT AVG(a) FROM << { 'a' : 1 }, { 'a': 2 }, { 'a': 3 } >> -- 2.