SQL ACOS Function Example | acos() in SQL
SQL ACOS() is an inbuilt function that is used for finding the arc cosine of a number. The number should be in the range of -1 to 1; otherwise, it will return NULL.
SQL ACOS() function returns the arccosine of a number. In other words, this function returns the angle, in radians, whose cosine is the specified float expression. The return data type is float.
SELECT ACOS (Number);
Number: The number whose arc cosine value is to be retrieved.
SELECT COS (1);
Here, the arc cosine value is returned.
SELECT ACOS (1.02);
Here, the number specified was not within the range of -1 to 1, so NULL is returned.
SELECT COS (NULL);
Passing of NULL value as the argument will return a NULL value.
SELECT ACOS (0.25);
Here, arc cosine value is returned, which is of fractional type.
SELECT DEGREE (ACOS (0.5));
As the value returned by ACOS value is in radians so to get value in degree. Here, Degree function is used for retrieving the degree of arc cosine value of the number.