The SQL ASIN
function returns the arcsin of an input numeric expression.
In math, arcsin(x) is the inversion of the sine of x
where -1 <= x <= 1
. It means that arcsin(x) = sin-1(x)
.
Syntax #
The following shows the syntax of the ASIN
function.
ASIN(numeric_expression)
Code language: SQL (Structured Query Language) (sql)
Arguments #
The ASIN
function accepts a numeric_expression
that evaluates to a floating-point number in the range -1 and 1.
Return Type #
The ASIN
function returns a floating-point number in radians.
Examples #
The following example returns the arcsin of 0.5 and 1.
SELECT
ASIN(0.5) angle_1_radians,
ASIN(1) angle_2_radians;
Code language: SQL (Structured Query Language) (sql)
Output:
angle_1_radians | angle_2_radians
--------------------+--------------------
0.5235987755982989 | 1.5707963267948966
Code language: SQL (Structured Query Language) (sql)
To see the degrees value, you use the DEGREES
function.
SELECT
DEGREES(ASIN(0.5)) angle_1_degrees,
DEGREES(ASIN(1)) angle_2_degrees;
Code language: SQL (Structured Query Language) (sql)
angle_1_degrees | angle_2_degrees
--------------------+-----------------
30.000000000000004 | 90
Code language: SQL (Structured Query Language) (sql)
Most database systems support the ASIN
function.
Was this tutorial helpful ?