PI() function: π

SELECT PI();
Output is 3.141593

This is a mathematical constant (π) and MySQL displays PI() as an approximate double-precision value. Calculations use the underlying floating-point value, so tiny rounding differences can appear in trigonometric results.

PI() with DEGREES()

DEGREES function converts radian to degree.
SELECT DEGREES(PI());      -- 180
SELECT DEGREES(PI() / 2);  -- 90
SELECT DEGREES(PI() / 3);  -- about 60

PI with SIN() COS()

We can get sine of any value in radians by using sin(), note that sin(x) takes input in radian. Value of x is in radian.
SELECT SIN(PI());  -- approximately 0 (floating-point)
We can use use ROUND Function to rounds to output
SELECT ROUND(SIN(PI()));      -- 0
SELECT ROUND(SIN(PI() / 2));  -- 1
We will allow some decimal places to be shown as the value of SIN varies between 0 and 1.
SELECT ROUND(SIN(PI() / 3), 3);  -- 0.866
SELECT ROUND(SIN(PI() / 4), 4);  -- 0.7071
We can try COS values
SELECT ROUND(COS(PI() / 3), 3);  -- 0.500
SELECT ROUND(COS(PI() / 2), 3);  -- 0.000


SQL Math References COS() SIN() function DEGREES() to convert radian to degee


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