MySQL Math Functions
This page lists the mathematical functions in MySQL.
-
ABS
The MySQLABS()
function returns the absolute value of a specified number. -
ACOS
The MySQLACOS()
function returns the arc cosine of the specified number. -
ASIN
The MySQLASIN()
function returns the arc sine of the specified number. -
ATAN
The MySQLATAN()
function returns the arc tangent of the specified number. -
ATAN2
The MySQLATAN2()
function returns the arc tangent of two specified numbers. -
CEIL
The MySQLCEIL()
function returns the smallest integer value greater not less than the specified number. -
CEILING
The MySQLCEILING()
function returns the smallest integer value greater not less than the specified number. -
CONV
The MySQLCONV()
function converts a number from one number base to another, such as from base 10 to base 2. -
COS
The MySQLCOS()
function returns the cosine of the specified number. -
COT
The MySQLCOT()
function returns the cotangent of the specified number. -
DEGREES
The MySQLDEGREES()
function converts a value from radians to degrees and return the result. -
DIV
The MySQLDIV
operator computes the division of two integers and returns an integer result. -
EXP
The MySQLEXP()
function returns the value of the natural constante
raised to the power of the specified value. -
FLOOR
The MySQLFLOOR()
returns the largest integer value not greater than the specified number. -
GREATEST
The MySQLGREATEST()
function returns the largest value in the parameter list. -
LEAST
The MySQLLEAST()
function returns the smallest value in the parameter list. -
LN
The MySQLLN()
function returns the natural logarithm of the specified number. -
LOG
The MySQLLOG()
function returns the logarithm of the specified number to the specified base. -
LOG10
The MySQLLOG10()
function returns the base 10 logarithm of the specified number. -
LOG2
The MySQLLOG2()
function returns the base 2 logarithm of the specified number. -
MOD
The MySQLMOD()
function returns the remainder of one number divided by another. -
PI
The MySQLPI()
function returns the value ofπ
with 6 decimal places. -
POW
The MySQLPOW()
function returns the value of the first argument raised to the power of the second argument. -
POWER
The MySQLPOWER()
function returns the value of the first argument raised to the power of the second argument. -
RADIANS
The MySQLRADIANS()
function converts an angle measured in degrees to an approximately equivalent angle measured in radians. -
RAND
The MySQLRAND()
function returns a random decimal value with a positive sign, greater than or equal to0.0
and less than1.0
. -
ROUND
The MySQLROUND()
function rounds the specified number to the specified number of decimal places. -
SIGN
The MySQLSIGN()
function returns sign of the argument as1
,0
, or-1
, depending on whether the argument is positive, zero, or negative. -
SIN
The MySQLSIN()
function returns the sine of the specified number. -
SQRT
The MySQLSQRT()
function returns the square root of a nonnegative number. -
TAN
The MySQLTAN()
function returns the tangent of the specified number. -
TRUNCATE
The MySQLTRUNCATE()
function truncates a numbers to a specified number of decimal places.