sqrt(): square root of any number

SELECT SQRT(16);  -- 4
SELECT SQRT(20);  -- 4.47213595499958
For a negative argument, SQRT() returns NULL.
SELECT SQRT(-25);  -- NULL

Example of sqrt function with update query

We know how to find out hypotenuse of a right angle triangle.
Right triangle showing sides used in the Pythagorean theorem
H² = A² + B²
H = √(A² + B²)
We will create one UPDATE query by using MySQL pow function.
Here it is
UPDATE sql_sqrt
SET H = SQRT(POW(A, 2) + POW(B, 2));
This will update the table with value of hypotenuse . Here is the PHP code to update the table.
require 'config.php'; // Database connection
$query = 'UPDATE sql_sqrt SET H = SQRT(POW(A, 2) + POW(B, 2))';
$stmt = $dbo->prepare($query);
$stmt->execute();
echo 'Successfully updated H';


Download SQL dump file of this table

SQL Math References Standard deviation Average value Query


Subscribe to our YouTube Channel here



plus2net.com




SQL Video Tutorials










✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer