SQL SIN Function

Savigo
You organize your data. Now organize your savings.
Set savings goals, track your progress, and stay on course.
Get Savigo for iPhone 

In SQL, the SIN function calculates the sine of an input argument.

In math, given the ABC triangle, the sine of an angle (A) is defined as the ratio between the length of the side that is opposite that angle (a) (which is not the hypotenuse) to the length of the hypotenuse (h):

sin A = a / h
SQL_trigonometry_triangle

For the inverse of the SIN function, see the ASIN function.

Syntax #

The following illustrates the syntax of the SIN function.

SIN(numeric_expression)

Argument #

The SIN function accepts a numeric_expression that represents the angle in radians for which the sine is calculated.

Return Type #

The SIN function returns a floating-point number.

Examples #

The following statement returns the sine values of  π,/2 and π/6.

SELECT SIN(PI()/2) sin_half_pi, 
       SIN(PI()/6) sin_one_sixth_pi;

Output:

sin_half_pi | sin_one_sixth_pi
------------+------------------
          1 |              0.5
(1 row)

Note that we use the PI function to get the π constant.

Most database systems support the SIN function with the same behavior.

Was this helpful?