SQL ACOS Function

The SQL ACOS function calculate the trigonometry Arc cosine for the specified expression. SQL Arc cosine also called the inverse of a COSINE Function.The syntax of the SQL Server ACOS Function is

SELECT ACOS (Float_Expression)
FROM [Source]

TIP: The ACOS function only accepts float values between -1 and 1. For this ACOS Function demo, we use the Math Table data

SQL ACOS Function Example 1

The ACOS Function is used to calculate the Arc cosine for the given angle. The following SQL Server query will show you multiple ways to use the Arc COSINE function.

DECLARE @i float
SET @i = -0.80

SELECT ACOS(@i) AS [Arc Cosine]

-- Calculating ACOS directly
SELECT ACOS(0.27) AS [Arc Cosine]

-- Calculating ACOS directly
SELECT ACOS(0.25 + 0.55 - 0.77) AS [Arc Cosine]
SQL ACOS FUNCTION 1

We used the ACOS function to calculate the Arccosine value for the variable @i. It means ACOS(-0.80)), and assigned a new name ‘Arc Cosine’ using ALIAS.

SELECT ACOS(@i) AS [Arc Cosine]

SQL Arc Cosine Function Example 2

We calculate the Arc cosine value for all the records present in [Service Grade] using the ACOS Mathematical Function.

SELECT [EnglishProductName]
      ,[Color]
      ,[StandardCost]
      ,[SalesAmount]
      ,[Service Grade]
      ,ACOS([Service Grade]) AS [Arc Cosine] 
  FROM [Mathemetical Functions]
SQL ACOS FUNCTION 2