SQRT
Returns the square root of a number.
MySQL 8.4
SQRT(num)- num
- Non-negative numberDOUBLE
Return value
A floating-point number (DOUBLE); NULL for a negative number
Examples
Square root of 4
MySQL 8.4
SELECT SQRT(4);Root of a negative number
MySQL 8.4
SELECT SQRT(-4);Details
For a negative number MySQL returns NULL, while PostgreSQL gives an error. A root of another degree is calculated with POW and a fractional exponent.