MySQL includes a bunch of functions and operators that can help us when working with data.
The following is a list of mathematical functions available in MySQL. You can click on each function name to see an explanation of the function, its syntax, and examples.
ABS()- Returns the absolute value of a given value.
ACOS()- Returns the arc cosine of a number.
ASIN()- Returns the arc sine of a number.
ATAN()- Returns the arc tangent of a value (or values).
ATAN2()- Returns the arc tangent of the two arguments.
CEIL()- Synonym for
CEILING(). CEILING()- Rounds a number up to the nearest integer (returns the smallest integer not less than its argument).
CONV()- Convert numbers between different number bases.
COS()- Returns the cosine of a number.
COT()- Returns the cotangent of a number.
CRC32()- Computes a cyclic redundancy check value.
DEGREES()- Converts from radians to degrees.
EXP()- Returns e to the power of x.
FLOOR()- Rounds a number down to the nearest integer (returns the largest integer value not greater than the argument).
LN()- Returns the natural logarithm of a number.
LOG()- Returns the natural logarithm of a number. Also allows you to specify the base.
LOG10()- Returns the base-10 logarithm of the argument.
LOG2()- Returns the base-2 logarithm of the argument.
MOD()- Performs a modulo operation. Returns the remainder of N divided by M.
PI()- Returns the value of π (pi).
POW()- Return the argument raised to the specified power.
POWER()- Synonym for
POW(). RADIANS()- Converts a value from degrees to radians, and returns the result.
RAND()- Returns a random floating-point value.
ROUND()- Rounds a number up or down to a given number of decimal places.
SIGN()- Returns the sign of the argument (so you can know whether a number is positive or negative).
SIN()- Returns the sine of the argument.
SQRT()- Returns the square root of the argument.
TAN()- Returns the tangent of the argument.
TRUNCATE()- Truncates a value to specified number of decimal places.