Mysql Math functions

What are the Math Functions in MySQL?

Explanation

Mathematical Functions :


Now lets see Mysql Math functions with examples.
ABS(X) :
This function returns the Absolute value of the given value.
mysql> select abs(5);
--> 5
mysql> select abs(-25);
--> 25
ACOS(X) :
Returns the arc Cosine value of the given number.
mysql> select acos(0);
--> 1.5707963267949
mysql> select acos(1);
--> 0
ASIN(X) :
Returns the arc Sine value of the given number.
mysql> select asin(1);
--> 1.5707963267949
mysql> select asin(0);
--> 0
ATAN(X) :
Returns the arc Tangent value of the given number.
mysql> select atan(1);
--> 0.78539816339745
mysql> select atan(2);
--> 1.1071487177941
CEIL(X) or CEILING(X) :
Returns the smallest integer nearest to the given value but not less than that.
mysql> select ceil(1.14);
--> 2
mysql> select ceiling(-1.14);
--> -1
COS(X) :
Returns the Cosine of X, where X is given in radians.
mysql> select cos(pi());
--> -1
mysql> select cos(0);
--> 1
COT(X) :
Returns the cotangent value of X.
mysql> select cot(1);
--> 0.64209261593433
mysql> select cot(45);
--> 0.61736962378356
Press next to learn more mysql math functions.


Ask Questions

Ask Question