What is SQRT() in SQL?

The SQRT() function returns the square root of a non-negative number. Figure 1 shows the mathematical representation of the SQRT() function.

Figure 1: Mathematical representation of the SQRT() function

Syntax

SQRT(number)

Parameter

SQRT() requires a non-negative number as a parameter.

Return value

SQRT() returns the square rooof the number sent as a parameter. If a parameter is a negative number, it returnsNULL`.

Example

/*example showing how to use SQRT(X)*/
-- positive number
select SQRT(4);
-- negative number
select SQRT(-6);
-- fractional number
select SQRT(4.6);

Free Resources