MySQL - SIN() Function
The SIN() function of MySQL is used to calculate the trigonometric sine value of a given number. The sine of an angle is defined as the ratio of the opposite side of the given angle to the hypotenuse (the longest side of the triangle) in a right-angled triangle.
This function accepts an integer value (in radians) as an argument and returns the corresponding sine value.
Syntax
Following is the syntax of MySQL SIN() function −
SIN(x);
Parameters
This function takes an integer value in radians as a parameter.
Return Value
This function returns the sine of the given angle as a numeric value.
Example
In the following query, we are using the MySQL SIN() function to calculate the sine of 8 radians −
SELECT SIN(8) As Result;
Output
The output for the query above is produced as given below −
| Result |
|---|
| 0.9893582466233818 |
Example
We can also pass PI() function as a value to this function as shown below. The value of PI() function is 3.14 −
SELECT SIN(PI()) As Result;
Output
This will produce the following result −
| Result |
|---|
| 1.2246467991473532e-16 |
Example
Following is another example of this function, where we are calculating the sine of -16 radians −
SELECT SIN(-16) As Result;
Output
The output is displayed as below −
| Result |
|---|
| 0.2879033166650653 |
Example
Here, we are calculating the sine of 0 radians −
SELECT SIN(0) As Result;
Output
The sine value for 0 is 0 −
| Result |
|---|
| 0 |