MIN (Azure Cosmos DB)

APPLIES TO: SQL API

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

Syntax

MIN(<scalar_expr>)  

Arguments

scalar_expr
Is a scalar expression.

Return types

Returns a scalar expression.

Examples

The following example returns the minimum value of propertyA:

SELECT MIN(c.propertyA)
FROM c

Remarks

This system function will benefit from a range index. The arguments in MIN can be number, string, boolean, or null. Any undefined values will be ignored.

When comparing different types data, the following priority order is used (in ascending order):

  • null
  • boolean
  • number
  • string

Next steps