Related Articles

# Sin(), Cos() and Tan() Function in MariaDB

• Last Updated : 23 Oct, 2020

1. Sin() Function :
In MariaDB, SIN() function is used to returns the sine of a number. In this function, a number will be passed as a parameter and this function will return the sine of that number. The number used to calculate the sine. It is expressed in radians.

Syntax :

`SIN(number)`

Parameter : Required. A numeral value.

• number – A number that is used for sine.

Returns : Sine of a number in radians.

Example-1 :

`SELECT SIN(0);`

Output –

`0`

Example-2 :

`SELECT SIN(3.5);`

Output –

`-0.35078322768961984`

Example-3 :

`SELECT SIN(-7);`

Output –

`-0.6569865987187891`

2. Cos() Function :
In MariaDB, Cos() function is used to return the cosine of a number. A number will be passed in this function as a parameter and it will return the cosine of that number. The number used to calculate the cosine. It is expressed in radians.

Syntax :

`COS(number)`

Parameter : Required. A numeral value.

• number – A number that is used for cosine.

Returns : Cosine of a number in radians.

Example-1 :

`SELECT COS(PI());`

Output –

`-1`

Example-2 :

`SELECT COS(1);`

Output –

`0.5403023058681398`

Example-3 :

`SELECT COS(-0.4);`

Output –

`0.9210609940028851`

3. Tan() Function :
In MariaDB, Tan() function is used to return the tangent of a number. A number will be passed in this function as a parameter and it will return the tangent of that number. The number used to calculate the tangent. It is expressed in radians.

Syntax :

`TAN(number)`

Parameter : Required. A numeral value.

• number – A number that is used for tangent.

Returns : Tangent of a number in Radians.

Example-1 :

`SELECT TAN(-3);`

Output –

`0.1425465430742778`

Example-2 :

`SELECT TAN(0);`

Output –

`0`

Example-3 :

`SELECT TAN(0.5);`

Output –

`0.5463024898437905`

Attention reader! Don’t stop learning now. Learn SQL for interviews using SQL Course  by GeeksforGeeks.

My Personal Notes arrow_drop_up