# MySQL SQRT() function

## SQRT() function

MySQL SQRT() returns the square root of a non-negative number of the argument.

This function is useful in -

- In geometry and trigonometry, SQRT() is frequently used to calculate distances, lengths, and dimensions of shapes and figures.
- SQRT() is used to compute the square root of variances, which are key measures in statistics for understanding the spread or dispersion of data points.
- Engineers and physicists use SQRT() to analyze and model physical systems.
- In finance and economics, SQRT() can be used to calculate standard deviations, which are crucial in risk assessment, portfolio management, and investment strategies.
- In many scientific and engineering applications, it's important to estimate or quantify errors or uncertainties.
- SQRT() is useful for validating input data or for checking the validity of certain calculations, particularly when dealing with physical or real-world measurements.
- SQRT() can be employed in data preprocessing or feature engineering steps where scaling or normalizing data is necessary.
- In computer graphics and visualization, SQRT() can be used to calculate dimensions, distances, and sizes of objects, as well as to handle transformations.

**Syntax:**

SQRT(X)

Where **X** is a number

**Syntax Diagram:**

**MySQL Version: 8.0**

**Pictorial presentation of MySQL SQRT() function**

**Example of MySQL SQRT() function**

Code:

```
SELECT SQRT(25);
```

**Explanation:**

The above statement will return the square root of the given number 25.

Output:

mysql> SELECT SQRT(25); +----------+ | SQRT(25) | +----------+ | 5 | +----------+ 1 row in set (0.00 sec)

**Example: SQRT() function using negative value**

Code:

```
SELECT SQRT(-25);
```

**Explanation:**

The above statement will return NULL because the value of the argument (-25) is negative.

Output:

mysql> SELECT SQRT(-25); +-----------+ | SQRT(-25) | +-----------+ | NULL | +-----------+ 1 row in set (0.00 sec)

**It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.**

https://www.w3resource.com/mysql/mathematical-functions/mysql-sqrt-function.php

**Weekly Trends and Language Statistics**- Weekly Trends and Language Statistics