MySQL SIN Function

MySQL SIN function is one of the Numeric Functions, which is useful to calculate the trigonometric sine value of the specified expression. The mathematical formula behind this Sine method is SIN(x) = Length of the Opposite Side / Length of the Hypotenuse. The basic syntax of the SIN in MySQL is as shown below:

SELECT SIN (Numeric_Expression)
FROM Source

To demonstrate this Numeric method, we are going to use the below shown data

MySQL SIN Function 1

MySQL SIN Function Example

The MySQL SIN function returns the trigonometric sine value for any numeric value, and the following query shows multiple ways to use this method.

-- Negative
SELECT SIN(-15.35) AS `SineValue`;

--Positive
SELECT SIN(5.25) AS `SineValue`;

-- Numeric Expression
SELECT SIN(2.25 + 2.75 - 5.00) AS `SineValue`;

-- string number
SELECT SIN('9.73') AS `SineValue`;

-- String text
SELECT SIN('MySQL') AS `SineValue`;

As you can from the screenshot below, we used the SIN function to find the Sine values for different values. And, we assigned a new name to the MySQL result as ‘ Sine Value’ using ALIAS Column.

MySQL SIN Function Example 2

This Numeric also allows you to find the sine values for the data in a table. In this example, we are going to find the sine for all the records present in the Tax Amount column and Service Grade column.

SELECT Product, Color,
		StandardCost, Sales, TaxAmt,
        SIN(TaxAmt) AS `Tax SineValue`,
        ServiceGrade,
        SIN(ServiceGrade) AS `Grade SineValue`
FROM `numeric functions`;
MySQL SIN Function Example 3