ACOS()
Published Jun 21, 2023
Contribute to Docs
The SQL function ACOS()
calculates the arccosine of a given value, expressed in radians.
Syntax
ACOS(value);
value
is the number, for which the arccosine is calculated. This input value must be between -1 and 1, or the function will return NULL
.
Note: The output value of the
ACOS()
function uses radians, not degrees. To convert radians to degrees, the radian value can be multiplied by 180/π.
Example
The following example uses the data given in the table values
:
id | input_value |
---|---|
1 | 0.8 |
2 | 1 |
3 | -0.5 |
The ACOS()
function is used to calculate the arccosine as the output_value
:
SELECT id, input_value, ACOS(input_value) AS output_valueFROM values;
The output will be:
id | input_value | output_value |
---|---|---|
1 | 0.8 | 0.643501109 |
2 | 1 | 0 |
3 | -0.5 | 2.0943951 |
Note: For the use of this method with SQL databases like MySQL, SQLite, PostgreSQL, or SQL Server, refer to their respective documentation for more details on the
ACOS()
function implementation and compatibility.
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn SQL on Codecademy
- Skill path
Analyze Data with SQL
Learn to analyze data with SQL and prepare for technical interviews.Includes 9 CoursesWith CertificateBeginner Friendly17 hours - Free course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner Friendly5 hours