Tan Function In Sql in SQL
The TAN function in SQL returns the tangent of a given numeric expression (usually an angle in radians).
? Syntax
TAN(number)number: The angle in radians for which you want the tangent value.
? Description
Computes the tangent of the angle.
The input should be in radians, not degrees.
Returns a floating-point value.
? Examples
SELECT TAN(PI()/4) AS TangentValue; -- Returns approximately 1, since tan(45°) = 1SELECT TAN(0) AS TangentZero; -- Returns 0SELECT TAN(PI()/2) AS TangentHalfPi; -- Returns a very large number (tangent of 90° approaches infinity)Notes
To convert degrees to radians, multiply degrees by
PI()/180.For example, tangent of 45 degrees:
SELECT TAN(45 * PI()/180) AS Tangent45Degrees;If you want examples specific to your SQL dialect or help with angle conversions, just ask!