TAN Function in SQLThe TAN() is a mathematics function which returns the tangent value of the given number in the Structured Query Language. Syntax of TAN FunctionIn this SELECT syntax, we have to pass that numeric number in the function whose tan value we want to find. In the Structured Query Language, we can also use the TAN function in SELECT query with the table field: In this SELECT query, we have to define the name and field of that table on which we want to perform the TAN function. Examples of TAN functionExample 1: This example returns the tangent value of the specified number: Output:
Example 2: This example returns the tangent value of the specified number: Output:
Example 3: This example returns the tangent value representation of 19: Output:
Example 4: This example returns the tangent value representation of the numbers from 21 to 30: Output:
Example 5: This example uses the TAN function with the SQL table. In this example, we will create the new table through which we will perform the TAN function on the numeric fields: 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 TAN function with the Product_Quantity column of the above Product_Details table: This query returns the tangent value of product id of each product from the table. Output:
Query 2: The following SELECT query uses the TAN function with the and Purchasing_Price and Selling_Price column of the above Product_Details table: This query shows the tangent value of purchasing price of each product. Output:
Query 3: The following SELECT query uses the TAN function with the Product_Rating column of the above Product_Details table: This query shows the tan value of rating of each product from the above table. Output:
Query 4: The following SELECT query uses the TAN function with the Product_Quantity column of the above Product_Details table: This query shows the tangent value of quantity of each product from the above table. Output:
Next TopicCEIL Function in SQL |