SIN Function in SQLThe SIN is a SQL function of mathematics which returns the sine value of the specified number. Syntax of SIN FunctionIn 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 functionExample 1: This example returns the sine value of the number in the given query: Output:
Example 2: This example returns the sine value of 2 from the following SELECT query: Output:
Example 3: This example returns the sine value of 8: Output:
Example 4: This example returns the Sin_Value of 255: Output:
Example 5: This example returns the Sin_Value of NULL: Output:
Example 6: This example returns the sine value of all the numbers between 21 and 30: Output:
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:
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:
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:
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:
Next TopicACOS Function in SQL |