AVG (Azure Cosmos DB)

APPLIES TO: NoSQL

This aggregate function returns the average of the values in the expression.

Syntax

AVG(<numeric_expr>)  

Arguments

numeric_expr
Is a numeric expression.

Return types

Returns a numeric expression.

Examples

The following example returns the average value of propertyA:

SELECT AVG(c.propertyA)
FROM c

Remarks

This system function will benefit from a range index. If any arguments in AVG are string, boolean, or null, the entire aggregate system function will return undefined. If any argument has an undefined value, it will not impact the AVG calculation.

Next steps