SIN

SIN is an SQL mathematical function that returns the sine of a specified angle.

Example

SELECT SIN(PI()/4);

Output

0.70710678118655

Explanation

The SIN() function in MySQL returns the sine of an angle provided in radians. The PI() function returns the value of PI. Thus, SIN(PI()/4) calculates the sine of 45 degrees. The output 0.70710678118655 is the result of this calculation.

Example

SELECT SIN(1);

Output

0.8414709848078965

Explanation

The SIN function in PostgreSQL calculates the sine of a number. In the example above, the sine of 1 was computed.

Example

DECLARE @Value FLOAT;
SET @Value = PI()/4;
SELECT SIN(@Value) as SinValue;

Output

SinValue
----------------------
0.707106781186547

Explanation

In the example, a variable @Value is declared and initialized to PI()/4. SIN(@Value) function is called which calculates the sine of the given value. The result is then selected and displayed as SinValue, which is 0.707106781186547 in this case.

Example

SELECT SIN(radians(45)) FROM dual;

Output

0.707106781

Explanation

The above SQL command calculates the sine of 45 degrees. The radians function is used to convert 45 degrees to radians before SIN is called.

Example

SELECT SIN(1);

Output

0.8414709848078965

Explanation

The SIN function in SQLite returns the sine of a number. In the given example, SIN(1) returns 0.8414709848078965, which is the sine of 1.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.