MySQL ASIN() Function
In this context we will learn how we can use the ASIN() function in MySQL with proper syntax and good example.
Introduction of MySQL ASIN() function
The arc sine value of a number in the range of [ -1 to 1 ] is returned by the ASIN() function, which is a mathematical function in MySQL. When the number is not in the range of -1 to 1, then it will return a null value as output.
Syntax of the MySQL ASIN () function
The syntax of the MySQL ASIN () function is given as follows:
ASIN(num)
Parameter or arguments used in MySQL ASIN () function:
Only one parameter is accepted by the ASIN ( num ) function, and in ASIN () function, num is the parameter. Now we will understand it with the help of examples.
Num: It is the number which we want to calculate the arc sine value of that number. It should be in the range of -1 to 1.
Returns: It gives us the arc sine of the mentioned number.
Application used for ASIN() function:
The ASIN() function can be used in the given below MySQL versions.
- MySQL 5.7
- MySQL 5.6
- MySQL 5.5
- MySQL 5.1
- MySQL 5.0
- MySQL 4.1
- MySQL 4.0
- MySQL 3.23
Examples of MySQL ASIN() function:
Example: 1
Here, we will derive the arc sine value of 1 using the ASIN() function in MySQL.
SELECT ASIN( 1) as ASIN_ value ;
Output:
ASIN_ value
1.5707963267948966
1 row in set (0.00 sec)
Example 2:
Now we will derive the arc sine value of a number in the range ( 0, 1) using the ASIN() function in MySQL.
SELECT ASIN( 0.25 ) ASIN_ value ;
Output:
ASIN_ value
0.25268025514207865
1 row in set (0.00 sec)
Example 3:
Here, we will derive the arc sine value of a number which is in the range ( 0, -1) using the ASIN() function in MySQL.
Select ASIN( -0.35 ) as ASIN_ value;
Output:
ASIN_ value
-0.35757110364551026
1 row in set (0.00 sec)
Example 4:
Now we will derive the arc sine value of a number which is not in the range ( 0, -1) using the ASIN() function in MySQL.
SELECT ASIN(2.75) as ASIN_ value;
Output:
ASIN_ value
Null
1 row in set (0.00 sec)
Example 5:
Here, we will see how we can get the arc sine value of a numeric column in a table of the database.
Y |
-2 |
-1 |
-0.50 |
0 |
0.50 |
1 |
2 |
Table: Number
SELECT ASIN ( y ) as ASIN_ value from Number;
Output:
Y | ASIN_ value |
-2 | Null |
-1 | -1.5707963267948966 |
-0.50 | -0.5235987755982989 |
0 | 0 |
0.50 | 0.5235987755982989 |
1 | 1.5707963267948966 |
2 | Null |
1 row in set (0.00 sec)
In this above context, we have learned how we can use the ASIN() function for a number whose arc sine value we want to calculate.