43  SQL mathematical functions

Some common math functions are given below.

select ceiling(0.5); 
select ceiling(0.99),ceiling(0.1),ceiling(0.5);

1.0 | 1.0 | 1.0

cosine function

find nearest integer, lesser than the input. Ceil goes up, floor goes down.

select floor(0.99),floor(0.1),floor(0.5);

0.0 | 0.0 | 0.0

select log(2,32);  

5.0

select log10(100);                                                                           

2.0

the remainder after dividing X by Y. This is similar to the ‘%’ operator

constant PI value

select power(2,3); 

sign of n. That is

if n<0 then -1

if n=0 then 0 

if n>0 then 1 
select sin(90); 

0.893996663600558

select sin(radians(90)); 

1.0

SQRT

square root

TAN

tangent function

43.1 Math functions documentation