MySQL Mathematical Functions

From Techotopia
Revision as of 18:12, 24 October 2007 by Neil (Talk | contribs) (New page: MySQL provides a a number of functions used for performing algebraic, geometric and trigonometric calculations on database data. In this chapter the basics of using this functions will be ...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

MySQL provides a a number of functions used for performing algebraic, geometric and trigonometric calculations on database data. In this chapter the basics of using this functions will be covered.

MySQL Arithmetic Functions

MySQL provides a wide range of functions designed to serve a range of arithmetical purposes. The following table lists each of the common functions togetehr with a brief description (although most are self-explanatory):

Name Description
ABS() Returns the absolute value
ACOS() Returns the arc cosine
ASIN() Returns the arc sine

ATAN2(), ATAN()

Returns the arc tangent of the two arguments
ATAN() Returns the arc tangent
/ Division operator

CEILING(), CEIL()

Returns the smallest integer value not less than the argument
COS() Returns the cosine
COT() Returns the cotangent
CRC32()() Compute a cyclic redundancy check value
DEGREES() Convert radians to degrees
DIV() Integer division
EXP() Raise to the power of of the argument
FLOOR() Returns the largest integer value not greater than the argument
MOD() Returns the remainder
LN() Returns the natural logarithm of the argument
LOG10() Returns the base-10 logarithm of the argument
LOG2() Returns the base-2 logarithm of the argument
LOG() Returns the natural logarithm of the first argument
- Minus operator
% Modulo operator
PI() Returns the value of pi
+ Addition operator

POW(), POWER()

Returns the argument raised to the specified power
RADIANS() Returns argument converted to radians
RAND() Returns a random floating-point value
ROUND() Rounds the argument
SIGN() Returns the sign of the argument
SIN() Returns the sine of the argument
SQRT() Returns the square root of the argument
TAN() Returns the tangent of the argument
* Times operator
TRUNCATE() Truncates to specified number of decimal places specified in the argument
- Change the sign of the value passed as an argument