SQL SIN Function

The SQL SIN function calculates the trigonometry sine for the specified expression. The syntax of the SQL Server SIN Function is

-- SQL Server SIN Syntax
SELECT SIN (Float_Expression)
FROM [Source]

For this SIN Function demo, we use the Math Table data

SQL SIN Function Example 1

The mathematical formula for this function is SIN(x) = Length of the Opposite Side / Length of the Hypotenuse. The SIN Function calculates the sine for a given angle. The following query shows multiple ways to use the SIN function.

DECLARE @i float
SET @i = 208.45

SELECT SIN(@i)AS [SQL SINE]

-- Calculating SIN directly
SELECT SIN(0.24)AS [SQL SINE]

-- Calculating SIN directly
SELECT SIN(0)AS [SQL SINE]

-- Calculating SIN directly
SELECT SIN(1)AS [SQL SINE]
SQL SIN FUNCTION 1

We used this SQL Server function to calculate the sine value for the variable @i. It means SIN(208.45)), and assigned the name using the ALIAS Column.

SELECT SIN(@i)AS [SQL SINE]

SIN Function Example 2

We are going to calculate the sine value for all the records present in [Tax Amount] and [Service grade] using SIN Mathematical Function.

SELECT [EnglishProductName]
      ,[SalesAmount]
      ,[TaxAmt]
      ,SIN([TaxAmt]) AS [Tax Sine]
      ,[Service Grade] AS Grade
      ,SIN ([Service Grade]) AS [SIN Function] 
  FROM [Mathemetical Functions]
SQL SIN FUNCTION 2