AppDividend
Latest Code Tutorials

# SQL SQRT() Function: The Complete Guide

The SQRT() in the SQL function returns the square root of a number.

## SQL SQRT()

SQL SQRT() is a built-in function used to return the square value of the specified number. The SQRT() returns the square root of a given value in the argument. An expression is a numeric value or numeric data type. All of the above platforms support the SQL syntax of SQRT().

### Syntax

```SELECT SQRT (Number);
```

### Parameters

Number: A positive number whose square root is to be calculated. It can also be an expression of float or a type that can be implicitly converted to float.

### Examples

#### Query 1

```Select SQRT (64);
```

`8`

#### Query 2

```Select SQRT (25);
```

```5
```

#### Query 3

```Select SQRT (10);
```

#### Output

```3.16227766016838
```

#### Explanation

As the return type of the SQRT function is float. So, the number was returned in decimal form.

#### Query 4

```Select SQRT (0);
```

`0`

#### Query 5 (Negative Value)

```Select SQRT (-64);
```

```NULL
```

#### Explanation

Negative values will return NULL or “An invalid floating-point operation occurred.”

#### Query 6

```Select SQRT (60+4);
```

`8`

#### Explanation

Here, the arithmetic operation is performed inside the function, similar to the 1st example.

## SQL Server SQRT()

SQRT() function in SQL Server returns the square root of a number. SQL SQRT() function is used to find out the square root of any number. For example, you can use the SELECT statement to find out the square root of any number.

## MySQL SQRT()

MySQL SQRT() returns the square root of a non-negative number of the argument. The above statement will return the square root of the given number, 25. The above statement will return NULL because the value of the argument (-25) is negative.