TAN
TAN is a mathematical function in SQL that returns the tangent of a specified float expression or the angles in radians.
TAN(X)
- x: This refers to the numerical value in radians for which the tangent is to be determined. It represents the angle in a unit circle whose tangent is to be calculated.
Example
Output
Explanation
In the given SQL command, we are using the TAN function. This function calculates the tangent of a number. We input PI()/4 as the argument which is the equivalent to 45 degrees in radians. The tangent of 45 degrees is 1, and that’s the result displayed by MySQL.
TAN( float_expression )
- float_expression: The numeric expression for which the Tangent is to be calculated. The input argument must be of a data type that is implicitly convertible to float.
Example
Output
Explanation
In this example, the TAN()
function in SQL Server returns the tangent of the input angle in degrees, which is given as 45. The tangent of 45 degrees is 1.
TAN(number NUMBER) RETURN NUMBER;
- number: This parameter is the numeric value for which the tangent is to be computed. It should be in the range of - (10^38 -1) to (10^38 - 1). It’s the angle in radians for which the Oracle function calculates the tangent.
Example
Output
Explanation
This SQL command uses the TAN
function, which returns the tangent of a number. Here, it is applied to the number 45. The FROM dual
is a specific feature of Oracle SQL and is used to select from a dummy table. The result is 1, which is the tangent of 45 in radians.