MySQL ATAN function is one of the Numeric methods, which is useful to calculate the trigonometric Arc Tangent of the specified expression. The Arctangent is also called the inverse of a Tangent. The basic syntax of the ATAN is as shown below:
SELECT ATAN (Numeric_Expression) FROM Source
To demonstrate this Numeric function, we are going to use the below shown data.
MySQL ATAN Function Example
The ATAN returns the trigonometric Arc tangent values for any numeric data. The following query shows multiple ways to use this method.
-- Negative SELECT ATAN(-2.54) AS `ArcTangentValue`; -- Positive SELECT ATAN(0.52) AS `ArcTangentValue`; -- Numeric Expression SELECT ATAN(4.25 + 7.75 - 9.25) AS `ArcTangentValue`; -- string value SELECT ATAN('1.35') AS `ArcTangentValue`; -- String SELECT ATAN('MySQL') AS `ArcTangentValue`;
As you can see, we used this function to find the ArcTangent of different values.
This Numeric method also allows you to find the arctangent of the data inside a table. In this MySQL example, we are going to find the arctangent (or inverse of a tangent) for all the records present in the Service Grade column.
SELECT Product, Color, StandardCost, Sales, TaxAmt, ServiceGrade, ATAN(ServiceGrade) AS `ArcTangentValue` FROM `numeric functions`;
Please refer TAN method to understand the Tangent Function.