SQL SIN Function

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

SELECT SIN (Float_Expression)
FROM [Source]

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

Math Table

SQL SIN Function Example

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 [SQLSINE]

-- Calculating SIN directly
SELECT SIN(0.24)AS [SQLSINE]

-- Calculating SIN directly
SELECT SIN(0)AS [SQLSINE]

-- Calculating SIN directly
SELECT SIN(1)AS [SQLSINE]
SQL SIN or SINE Function Example 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 [SQLSINE]

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
Categories SQL