SQRT()
Returns the square root of a non-negative number.
Description
SQRT returns the square root of a number — the value that, multiplied by
itself, gives the original. SQRT(16) is 4. It's handy for standardizing
variances or geometric calculations.
Syntax
SQRT(expression)Parameters
| Name | Description | Optional |
|---|---|---|
| expression | A non-negative numeric column or expression. | No |
Return Type
Returns a DOUBLE.
Examples
Store (Customers/Orders/Products)
Loading database engine...
Store (Customers/Orders/Products)
Loading database engine...
SQRT vs POWER
SQRT(x) is identical to POWER(x, 0.5). Use whichever reads better.
Common Mistakes
- Negative input.
SQRTof a negative number errors (no imaginary numbers in SQL). Guard withABSor aWHEREif needed. - Expecting an integer. The result is a DOUBLE, often with decimals.
- Confusing with squaring.
SQRT(9)is3, the inverse ofPOWER(3, 2).
Related Functions
See also: POWER, ABS.