SQL ASIN: Calculate Arcsin

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)
  angle_1_radians  | angle_2_radians
-------------------+-----------------
 0.523598775598299 | 1.5707963267949
(1 row)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 |              90
(1 row)Code language: SQL (Structured Query Language) (sql)

Most database systems support the ASIN function.

Was this tutorial helpful ?