MySQL ATAN2 function is one of the Numeric Functions, which is useful to return the arc tangent between specified two variables, i.e., x and y. Or you can say it returns the angle between the positive x-axis and the line from the origin to the point (y, x).
The basic syntax of the MySQL ATAN2 Function is as shown below:
SELECT ATAN2 (Y, X) FROM Source -- Or you can use ATAN Function SELECT ATAN (Y, X) FROM Source
To demonstrate this Numeric method, we are going to use the below shown data

MySQL ATAN2 Function Example
The ATAN2 returns the trigonometric Arc tangent between two values, and the following query shows multiple ways to use this one.
-- on Negative Value SELECT ATAN2(-2.54, -152.56) AS `ATAN2 Value`; -- on Positive Value SELECT ATAN2(150.52, 224.68) AS `ATAN2 Value`; -- on string value SELECT ATAN2('10.35', '4.25') AS `ATAN2 Value`; -- on String SELECT ATAN2('MySQL', '14') AS `ATAN2 Value`;
As you can see, we used the ATAN2 function to find the Arc Tangent values between two different values.

This Numeric method also allows you to find the arctangent between two columns in a table. In this MySQL example, we are going to find the arctangent value between the standard cost column and the sales column. Here, we are also using the ATAN function to demonstrate that both these functions return the same output.
SELECT Product, Color, StandardCost, Sales, TaxAmt, ATAN2(StandardCost, Sales) AS `Sales ATAN2 Value`, ATAN(StandardCost, Sales) AS `Sales ATAN2 Value` FROM `numeric functions`;
