MySQL ATAN Function

MySQL ATAN function is one of the Numeric Functions, which is useful to calculate the trigonometric Arc Tangent of the specified expression. The MySQL Arc tangent also called the inverse of a Tangent. The basic syntax of the ATAN in MySQL is as shown below:

SELECT ATAN (Numeric_Expression)
FROM Source

To demonstrate this ATAN Numeric function, we are going to use the below shown data

MySQL ATAN Function Example 1

MySQL ATAN Function Example 1

The MySQL ATAN returns the trigonometric Arc tangent values for any numeric data. The following query shows multiple ways to use the ATAN function.

-- MySQL ATAN Function Example

-- Arc Tangent of Negative Value
SELECT ATAN(-2.54) AS `Arc Tangent Value`;

-- Arc Tangent of Positive Value
SELECT ATAN(0.52) AS `Arc Tangent Value`;

-- Arc Tangent of Numeric Expression
SELECT ATAN(4.25 + 7.75 - 9.25) AS `Arc Tangent Value`;

-- Arc Tangent of string value
SELECT ATAN('1.35') AS `Arc Tangent Value`;

-- Arc Tangent of String
SELECT ATAN('MySQL') AS `Arc Tangent Value`;

As you can see, we used the ATAN function to find the ArcTangent of different values.

MySQL ATAN Function Example 2

MySQL Arc Tangent Example 2

The MySQL ATAN Numeric Function 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.

-- MySQL Arc Tangent Example
USE mysqltutorial;
SELECT Product, Color,
		StandardCost, Sales, TaxAmt, 
        ATAN(ServiceGrade) AS `Arc Tangent Value`
FROM `numeric functions`;
MySQL ATAN Function Example 3

Please refer TAN Function to understand the Tangent Function.