ASIN Function in SQLThe ASIN is a SQL mathematics function which returns the arc sin of the specified number. This function returns NULL value, if the specified number is not between -1 to 1. Syntax of ASIN FunctionIn the ASIN syntax, we have to pass that number whose arc sin value we want to calculate. In the Structured Query Language, we can also use the ASIN function with the column 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 ASIN function. Examples of ASIN functionExample 1: This example returns the ASIN value of the specified number: Output:
Example 2: This example returns the arc sin value of the specified number: Output:
Example 3: This example returns the ASIN value of 0.1: Output:
Example 4: This example uses the ASIN function with the SQL table. In this example, we will create the new table through which we will perform the ASIN function on the columns of the table: 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 ASIN function with the Product_Quantity column of the above Product_Details table: This query shows the arc sin value value of product id of each product. Output:
Query 2: The following SELECT query uses the ASIN function with the and Purchasing_Price and Selling_Price column of the above Product_Details table: This query shows the arc sin value of purchasing and selling price of each product from the above table. Output:
Query 3: The following SELECT query uses the ASIN function with the Product_Rating column of the above Product_Details table: This query shows the arc sin value of rating of each product from the above table. Output:
Next TopicATAN Function in SQL |