MySQL SIN() Function

Last Updated : 26 Feb 2026

The sin() is a Math function of MySQL. This function is used to get the sine value of the given number. In this article, we will explore the concept of MySQL SIN() function in detail along with its various practical examples.

Syntax

Parameter:

number: It is the number for getting sine.

Return:

This function returns the sine value of the given number.

Example 1

Explanation: On execution of above query, the sin() function returns the sin value of the given angles.

Output: The output of this example is given below.

MySQL Math SIN() Function

Example 2

Explanation: On the execution of above query, the sin() function returns the sin value of the given negative angles.

Output: The output of this example is given below.

MySQL Math SIN() Function

Example 3:

Explanation: On execution of the above query, in the SIN() function, we can pass the PI() function as an argument, which returns the sin value.

Output: The output of this example is given below.

RESULT
1.2246467991473532e-16

Example 4:

Explanation: On execution of the above query, in the SIN() function calculate the sine value of 0 radians.

Output: The output of this example is given below.

RESULT
0

Using the MySQL SIN() function in a Table

The MySQL SIN function is used to find the sin value of given column value.

Follow the steps given below to perform the MySQL SIN() functionality in a table column.

Step 1: First, create a table named Math_Figure using the CREATE TABLE statement.

Step 2: After that INSERT data into a table using the INSERT TABLE statement.

Step 3: To check the information with the use of SELECT statement, whether the data is inserted or not.

IDDiagramColorValue
1ABCRed-1.22
2PQRBlue-0.5
3RSTGreen0
4DEFYellow0.54

Example:

Explanation: On execution of the above statement, the SIN function is used to return the SIN value of the Value column in a Math_Figure table.

Output: The output of this example is given below.

IDDiagramColorValueResult
1ABCRed-1.22-0.9390993563190676
2PQRBlue-0.5-0.479425538604203
3RSTGreen00
4DEFYellow0.540.5141359916531132

Using the MySQL SIN() function in a Table column with a WHERE clause

The MySQL SIN function is used to find the sin value of a given column value with restricted data using the WHERE clause.

Sample Table: Math_Figure

IDDiagramColorValue
1ABCRed-1.22
2PQRBlue-0.5
3RSTGreen0
4DEFYellow0.54

Example:

Explanation: On execution of the above statement, the SIN function is used to return the sin value from the Value column in a Math_Figure table where the value of the ID column is greater than 1.

Output: The output of this example is given below.

IDDiagramColorValueResult
2PQRBlue-0.5-0.479425538604203
3RSTGreen00
4DEFYellow0.540.5141359916531132

MySQL SIN function with an UPDATE Statement

In MySQL, the SIN() function does not change the data in the table. With the use of the UPDATE statement we can update the data.

Take an example of the Math_Figure table, which contains the following information.

IDDiagramColorValue
1ABCRed-1.22
2PQRBlue-0.5
3RSTGreen0
4DEFYellow0.54

Syntax:

Example: Write a MySQL query to calculate the SINE value.

Step1: First, add a new column i.e. SIN_VALUE to the existing table using the ALTER statement.

Step2: After that use an UPDATE statement to set the value of the SIN_VALUE column.

Explanation: On execution of the above UPDATE statement, it will update the records in the table. The SIN function is used to return the SIN value from the Value column in a Math_Figure table.

If you want to check that the content is updated in the table or not, then use the following statement.

Output: The output of this example is given below.

IDDiagramColorValueSIN_VALUE
1ABCRed-1.22-0.9390993563190676
2PQRBlue-0.5-0.479425538604203
3RSTGreen00
4DEFYellow0.540.5141359916531132

Next TopicMySQL Math