ATN2 Function in SQLThe ATN2 is a mathematics function which returns the arc tangent of two specified numbers. Syntax of ATN2 FunctionIn the ATN2 syntax, we have to pass two numeric numbers in the function from which we can find the value of arc tangent. In the Structured Query Language, we can also use the ATN2 function in the SELECT query with the table fields: In this SELECT query, we have to define the name and fields of that table on which we want to perform the ATN2 function. Examples of ATN2 functionExample 1: This example returns the arc tangent value of the specified numbers: Output:
Example 2: This example returns the arc tangent value of -0.5 and 2: Output:
Example 3: This example returns the arc tangent value of 80 and 110: Output:
Example 4: This example returns the arc tangent value of both negative numbers: Output:
Example 5: This example returns the arc tangent value with the combination of number and PI function: Output:
Example 6: This example uses the ATN2 function with the SQL table. In this example, we will create the new table through which we will perform the ATN2 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 Vehicle_Details table for storing the details of purchasing and selling vehicles: The following multiple INSERT queries insert the records of vehicles with their quantity, and number of selling and purchasing vehicles into the Vehicle_Details table: The following SELECT statement displays the inserted records of the above Vehicle_Details table:
Query 1: The following SELECT query uses the ATN2 function with the Vehicle_ID and Vehicle_Quantity columns of the above Vehicle_Details table: This query shows the arc tangent value of id and quantity of each vehicle. Output:
Query 2: The following SELECT query uses the ATN2 function with the Purchasing_Vehicles and Selling_Vehicles columns of the above Vehicle_Details table: This query shows the arc tangent value of all purchasing and selling vehicles. Output:
Query 3: The following SELECT query uses the ATN2 function with the Purchasing_Vehicles and Vehicle_Quantity columns of the above Vehicle_Details table: This query shows the arc tangent value of purchasing and quantity of each vehicle. Output:
Query 4: The following SELECT query uses the ATN2 function with the and Purchasing_Vehicles and Vehicle_Quantity column of the above Vehicle_Details table: This query shows the arc tangent value of selling and quantity of each vehicle. Output:
Next TopicLOG Function in SQL |