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