Rediger

Del via


SQRT (NoSQL query)

APPLIES TO: NoSQL

Returns the square root of the specified numeric value.

Syntax

SQRT(<numeric_expr>)  

Arguments

Description
numeric_expr A numeric expression.

Return types

Returns a numeric expression.

Examples

The following example returns the square roots of various numeric values.

SELECT VALUE {
    sqrtZero: SQRT(0),
    sqrtOne: SQRT(1),
    sqrtFour: SQRT(4),
    sqrtPrime: SQRT(17),
    sqrtTwentyFive: SQRT(25)
}
[
  {
    "sqrtZero": 0,
    "sqrtOne": 1,
    "sqrtFour": 2,
    "sqrtPrime": 4.123105625617661,
    "sqrtTwentyFive": 5
  }
]

Remarks

  • This function doesn't use the index.
  • If you attempt to find the square root value that results in an imaginary number, you get an error that the value can't be represented in JSON. For example, SQRT(-25) gives this error.