MySQL SIN() Function
The SIN()
function in MySQL calculates the trigonometric sine of a number. The input number represents an angle measured in radians, and the function returns the sine of that angle.
SIN(): Definition and Usage
The sine function (sin) is a fundamental trigonometric function used extensively in mathematics, science, and engineering. The SIN()
function in MySQL provides a convenient way to perform this calculation directly within your SQL queries. The result will always be a value between -1 and 1 (inclusive).
Syntax
Syntax
SIN(number)
Parameter Values
Parameter | Description |
---|---|
number |
The angle in radians for which you want to calculate the sine. This is required and must be a numeric value. |
Examples
Calculating the Sine of a Positive Number
This example calculates the sine of 2 radians.
Syntax
SELECT SIN(2);
Output
0.909297426825682
Calculating the Sine of a Negative Number
This example demonstrates calculating the sine of -1 radian.
Syntax
SELECT SIN(-1);
Output
-0.841470984807897