SIN() calculates the sine of an angle supplied in radians; use RADIANS() when your input is measured in degrees.
Run this SELECT query directly in MySQL or phpMyAdmin. It uses fixed inputs so you can verify the result without creating a table.
SELECT ROUND(SIN(RADIANS(30)), 2) AS sine_value;| sine_value |
|---|
| 0.50 |
SIN(X) returns the sine of X, where X is in radians.
SELECT ROUND(SIN(PI()), 2); -- Output: 0.00
SELECT SIN(PI() / 2); -- Output: 1
SELECT ROUND(SIN(PI() / 3), 2); -- Output: 0.87
SELECT SIN(X);
Use ROUND() for display precision and PI() for π.
SELECT SIN(RADIANS(0)); -- Output: 0
SELECT SIN(RADIANS(90)); -- Output: 1
SELECT ROUND(SIN(RADIANS(180)), 2); -- Output: 0.00
Floating-point precision can produce very small values instead of an exact zero.
Why does SIN(90) not return 1?
The input 90 is treated as radians. Use SIN(RADIANS(90)) for 90 degrees.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.