In this guide, we will explain how to use the MySQL SQRT function with syntax and examples.
Description
The MySQL SQRT function returns the square root of a number.
Syntax
The syntax for the SQRT function is:
SQRT( number )
Parameters or Arguments
number
A positive number used to calculate the square root.
Note
- The SQRT function will return NULL, if the number is a negative value.
Applies To
The SQRT function can be used in the following versions of :
- MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23
Example
Let’s look at some SQRT function examples and explore how to use the SQRT function.
For example:
mysql> SELECT SQRT(25); Result: 5 mysql> SELECT SQRT(26); Result: 5.0990195135927845 mysql> SELECT SQRT(0); Result: 0 mysql> SELECT SQRT(-9); Result: NULL
Next Topic : Click Here