What is SQL ACOS() Function

SQL ACOS() is a built-in 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.

Syntax

SELECT ACOS (Number);

Parameters

Number: The number whose arc cosine value is to be retrieved.

Examples

Query 1

SELECT COS (1);

Output

0

Explanation

Here, the arc cosine value is returned.

Query 2

SELECT ACOS (1.02);

Output

NULL

Explanation

Here, the number specified was not within the range of -1 to 1, so NULL is returned.

Query 3

SELECT COS (NULL);

Output

NULL

Explanation

Passing of NULL value as the argument will return a NULL value.

Query 4

SELECT ACOS (0.25);

Output

1.318116071652818

Explanation

Here, the arc cosine value is returned, which is of fractional type.

Query 5

SELECT DEGREE (ACOS (0.5));

Output

60

Explanation

As the value returned by ACOS value is in radians, so to get value in degree. Here, the Degree function retrieves the degree of the arc cosine value of the number.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.