AVG function in Amazon QLDB
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.