SQLite sin() Function

In SQLite, the sin() function returns the sine of a value in radians.

Syntax

sin(x)Code language: SQL (Structured Query Language) (sql)

Arguments

x

x is a number, an expression, or a table column that you want to calculate the sine.

Return Type

real

The function returns the sine of x in radians. If x is NULL, the function returns NULL.

If x is a string, the sin() function will convert it into a number before calculating the sine. If the conversion fails, the sin() function returns NULL.

Examples

The following example uses the sin() function to calculate the sine of zero (0):

SELECT sin(0) result;Code language: SQL (Structured Query Language) (sql)

Output:

result
------
0.0Code language: SQL (Structured Query Language) (sql)

The following statement uses the sin() function to return the sine of pi/2:

SELECT sin(pi()/2) result;Code language: SQL (Structured Query Language) (sql)

Output:

result
------
1.0Code language: SQL (Structured Query Language) (sql)
Was this tutorial helpful ?