Important
You are viewing the archived documentation of TiDB, which no longer receives updates. It is recommended that you use
the latest LTS version of the TiDB database.
Numeric Functions and Operators This document describes the arithmetic operators and mathematical functions.
Arithmetic operators Name Description +
Addition operator -
Minus operator *
Multiplication operator /
Division operator DIV
Integer division %
, MOD
Modulo operator -
Change the sign of the argument
Mathematical functions Name Description POW()
Return the argument raised to the specified power POWER()
Return the argument raised to the specified power EXP()
Raise to the power of SQRT()
Return the square root of the argument LN()
Return the natural logarithm of the argument LOG()
Return the natural logarithm of the first argument LOG2()
Return the base-2 logarithm of the argument LOG10()
Return the base-10 logarithm of the argument PI()
Return the value of pi TAN()
Return the tangent of the argument COT()
Return the cotangent SIN()
Return the sine of the argument COS()
Return the cosine ATAN()
Return the arc tangent ATAN2(), ATAN()
Return the arc tangent of the two arguments ASIN()
Return the arc sine ACOS()
Return the arc cosine RADIANS()
Return argument converted to radians DEGREES()
Convert radians to degrees MOD()
Return the remainder ABS()
Return the absolute value CEIL()
Return the smallest integer value not less than the argument CEILING()
Return the smallest integer value not less than the argument FLOOR()
Return the largest integer value not greater than the argument ROUND()
Round the argument RAND()
Return a random floating-point value SIGN()
Return the sign of the argument CONV()
Convert numbers between different number bases TRUNCATE()
Truncate to specified number of decimal places CRC32()
Compute a cyclic redundancy check value