MySQL Math Functions

This page lists the mathematical functions in MySQL.

  1. ABS

    The MySQL ABS() function returns the absolute value of a specified number.
  2. ACOS

    The MySQL ACOS() function returns the arc cosine of the specified number.
  3. ASIN

    The MySQL ASIN() function returns the arc sine of the specified number.
  4. ATAN

    The MySQL ATAN() function returns the arc tangent of the specified number.
  5. ATAN2

    The MySQL ATAN2() function returns the arc tangent of two specified numbers.
  6. CEIL

    The MySQL CEIL() function returns the smallest integer value greater not less than the specified number.
  7. CEILING

    The MySQL CEILING() function returns the smallest integer value greater not less than the specified number.
  8. CONV

    The MySQL CONV() function converts a number from one number base to another, such as from base 10 to base 2.
  9. COS

    The MySQL COS() function returns the cosine of the specified number.
  10. COT

    The MySQL COT() function returns the cotangent of the specified number.
  11. DEGREES

    The MySQL DEGREES() function converts a value from radians ​​to degrees and return the result.
  12. DIV

    The MySQL DIV operator computes the division of two integers and returns an integer result.
  13. EXP

    The MySQL EXP()function returns the value of the natural constant e raised to the power of the specified value.
  14. FLOOR

    The MySQL FLOOR() returns the largest integer value not greater than the specified number.
  15. GREATEST

    The MySQL GREATEST() function returns the largest value in the parameter list.
  16. LEAST

    The MySQL LEAST() function returns the smallest value in the parameter list.
  17. LN

    The MySQL LN() function returns the natural logarithm of the specified number.
  18. LOG

    The MySQL LOG() function returns the logarithm of the specified number to the specified base.
  19. LOG10

    The MySQL LOG10() function returns the base 10 logarithm of the specified number.
  20. LOG2

    The MySQL LOG2() function returns the base 2 logarithm of the specified number.
  21. MOD

    The MySQL MOD() function returns the remainder of one number divided by another.
  22. PI

    The MySQL PI() function returns the value of π with 6 decimal places.
  23. POW

    The MySQL POW() function returns the value of the first argument raised to the power of the second argument.
  24. POWER

    The MySQL POWER() function returns the value of the first argument raised to the power of the second argument.
  25. RADIANS

    The MySQL RADIANS() function converts an angle measured in degrees to an approximately equivalent angle measured in radians.
  26. RAND

    The MySQL RAND() function returns a random decimal value with a positive sign, greater than or equal to 0.0 and less than 1.0.
  27. ROUND

    The MySQL ROUND() function rounds the specified number to the specified number of decimal places.
  28. SIGN

    The MySQL SIGN() function returns sign of the argument as 1, 0, or -1, depending on whether the argument is positive, zero, or negative.
  29. SIN

    The MySQL SIN() function returns the sine of the specified number.
  30. SQRT

    The MySQL SQRT() function returns the square root of a nonnegative number.
  31. TAN

    The MySQL TAN() function returns the tangent of the specified number.
  32. TRUNCATE

    The MySQL TRUNCATE() function truncates a numbers to a specified number of decimal places.