# SIN Function in SQL

The SIN is a SQL function of mathematics which returns the sine value of the specified number.

### Syntax of SIN Function

In the SIN syntax, we have to pass that decimal number whose sine value we want to return.

In the Structured Query Language, we can also use the SIN function with the field of the table as shown in the following block:

In this syntax, we have to define the name and column of that table on which we want to perform the SIN function.

### Examples of SIN function

Example 1: This example returns the sine value of the number in the given query:

Output:

Sin_Value_of_101
0.45202578717835057

Example 2: This example returns the sine value of 2 from the following SELECT query:

Output:

Sin_Value_of_2
100.90929742682568171

Example 3: This example returns the sine value of 8:

Output:

Sin_Value_of_8
0.98935824662338179

Example 4: This example returns the Sin_Value of 255:

Output:

Sin_Value_of_255
-0.50639163492449091

Example 5: This example returns the Sin_Value of NULL:

Output:

Sin_Value_of_NULL
-

Example 6: This example returns the sine value of all the numbers between 21 and 30:

Output:

21222324252627282930
0.8366-8.8513-0.846-0.9055-0.13230.76250.95630.27090.6636-0.988

Example 7: This example uses the SIN function with the SQL table.

In this example, we will create the new table through which we will perform the SIN function on numerical columns:

The following shows the syntax to create the new table in SQL:

The following CREATE statement creates the Product_Details table for storing the price and quantity of products:

The following multiple INSERT queries insert the records of products with their selling and purchasing price into the Product_Details table:

The following SELECT statement displays the inserted records of the above Product_Details table:

104P110.250945NULL2022-04-30NULL
202P415.50045752022-01-285
103P218.25025NULL2022-02-184
111P725.2505152021-12-259
210P615.50050702021-10-15NULL
212P819.7501102502022-01-284
112P1010.2505508352022-04-11NULL

Query 1: The following SELECT query uses the SIN function with the Product_Quantity column of the above Product_Details table:

This query returns the sine value of each product id from the table.

Output:

Product_IDSin_Value_of_Product_ID
104-0.3216
2020.80641
1030.622
111-0.8654
2100.4677185
212-0.99834
112-0.8899956

Query 2: The following SELECT query uses the SIN function with the and Purchasing_Price and Selling_Price column of the above Product_Details table:

This query shows the sine value of purchasing and selling price of each product.

Output:

9450.58053NULL
450.8509075-0.387781
25-0.132351NULL
5-0.958915-0.650287
50-0.26237470-0.773890
110-4.42426250-0.97052
550-0.21948835-0.61599

Query 3: The following SELECT query uses the SIN function with the Product_Rating column of the above Product_Details table:

This query shows the sine value of rating of each product from the above table.

Output:

Product_RatingSin_Value_of_productrating
NULL
5-0.9589
4-0.7568024
90.41211
NULL
4-0.7568024
NULL