COUNT (Azure Cosmos DB)
APPLIES TO:
SQL API
This system function returns the count of the values in the expression.
Syntax
COUNT(<scalar_expr>)
Arguments
scalar_expr
Is any scalar expression
Return types
Returns a numeric expression.
Examples
The following example returns the total count of items in a container:
SELECT COUNT(1)
FROM c
COUNT can take any scalar expression as input. The below query will produce an equivalent results:
SELECT COUNT(2)
FROM c
Remarks
This system function will benefit from a range index for any properties in the query's filter.