25
May
2011
SQL Math Functions
he following is a reference to the main math functions in SQL:
ABS(X) Absolute value-converts negative numbers to positive, or leaves positive numbers alone
CEIL(X) X is a decimal value that will be rounded up.
FLOOR(X) X is a decimal value that will be rounded down.
GREATEST(X,Y) Returns the largest of the two values.
LEAST(X,Y) Returns the smallest of the two values.
MOD(X,Y) Returns the remainder of X / Y.
POWER(X,Y) Returns X to the power of Y.
ROUND(X,Y) Rounds X to Y decimal places. If Y is omitted, X is rounded to the nearest integer.
SIGN(X) Returns a minus if X < 0, else a plus.
SQRT(X) Returns the square root of X.
No Responses to “SQL Math Functions”