411 REFERENCE · Wikibooks
SQL Dialects Reference/Functions and expressions/Math functions/Numeric functions
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Numeric functions
functions-math.html#FUNCTIONS-MATH-FUNC-TABLE SQL%20Reference%20Guide/numericfunctions.htm lang_corefunc.html
T441 Absolute value of x ABS(x) ABS(x) ABS(x) ABS(x) mathematical-functions.html#function_abs ABS(x) ABS(x) ABS(x) ABS(x) ABS(x) functions002.htm#i81802 ABS(x) 189800 ABS(x) ABS(x) ABS(x)
Sign of number x SIGN(x) SIGN(x) mathematical-functions.html#function_sign SIGN(x) SIGN(x) SIGN(x) SIGN(x) SIGN(x) functions145.htm SIGN(x) 188420 SIGN(x) SING(x)
T441 Modulus (remainder) of MOD(x, y) MOD(x, y) x % y x % yMOD(x, y) mathematical-functions.html#function_mod x % yMOD(x, y) x % yMOD(x, y) MOD(x, y) MOD(x, y) MOD(x, y) functions088.htm x % y 190279 MOD(x, y) MOD(x, y)
T621 Smallest integer >= x CEILING(x)CEIL(x) CEILING(x)CEIL(x) mathematical-functions.html#function_ceiling CEILING(x)mathematical-functions.html#function_ceil CEIL(x) CEILING(x)CEIL(x) CEILING(x)CEIL(x) CEILING(x)CEIL(x) CEILING(x) functions017.htm#i97801 CEIL(x) CEILING(x) CEIL(x) CEIL(x)CEILING(x)
T621 Largest integer <= x FLOOR(x) FLOOR(x) FLOOR(x) mathematical-functions.html#function_floor FLOOR(x) FLOOR(x) FLOOR(x) FLOOR(x) FLOOR(x) functions058.htm FLOOR(x) FLOOR(x) FLOOR(x)
Round x (to precision of d digits) ROUND(x, d) ROUND(x[, d]) ROUND(x[, d]) mathematical-functions.html#function_round ROUND(x, d) ROUND(x[, d]) ROUND(x, d) ROUND(x) ROUND(x[, d]) ROUND(x[, d]) ROUND(x[, d]) ROUND(x, d)
Truncate x to n decimal places TRUNCATE(x, n)TRUNC(x, n) TRUNCATE(x[, dn) mathematical-functions.html#function_truncate sys.ms_trunc(x, n) TRUNC(x[, y]) TRUNC(x[, n]) TRUNC ROUND(x[, d], 1) TRUNC(x[, d]) TRUNCATE(x, n)TRUNC(x, n)
T621 Square root of x () SQRT(x) SQRT(x) SQRT(x) mathematical-functions.html#function_sqrt SQRT(x) SQRT(x) SQRT(x) SQRT(x) SQRT(x) SQRT(x) SQRT(x) SQRT(x) SQRT(x)
T621 Exponent of x () EXP(x) EXP(x) EXP(x) mathematical-functions.html#function_exp EXP(x) EXP(x) EXP(x) EXP(x) EXP(x) EXP(x) EXP(x) EXP(x)
T621 Power () POWER(x, y) POWER(x, y) mathematical-functions.html#function_pow POW(x, y)mathematical-functions.html#function_power POWER(x, y) POWER(x, y) POWER(x, y) POWER(x, y) POWER(x,y) POWER(x, y) functions112.htm POWER(x, y) POWER(x, y) POWER(x, y)x ** y
T621 Natural logarithm of x LN(x) LN(x) mathematical-functions.html#function_ln LN(x)mathematical-functions.html#function_log LOG(x) LN(x)LOG(x) LN(x) LN(x) LOG(x) LN(x) functions077.htm LOG(x) 190319 LN(x) LN(x) LOG(x)LN(x)
Logarithm of x, base b LOG(b, x) LOG(b, x) mathematical-functions.html#function_log LOG(b, x) LOG(b, x) LOG(b, x) LOG(b, x) functions080.htm LOG(x, b) LOG(b, x)
Logarithm, base 10 LOG10(x) LOG10(x) LOG10(x) LOG(x) LOG10(x) LOG(x) LOG(x) LOG10(x)
Randomize, set seed to x RAND(x) RAND(x) RAND(x) SETSEED(x) RANDOMIZE([x]) random()The random() function in Oracle can be found in the built-in DBMS package dbms_random. RAND(x) RAND(x) SET RANDOM_SEED x SQL%20Reference%20Guide/randomnumberfunctions.htm
Generate floating-point random number between 0 and 1 RAND() RANDOM() (between −263 and 263) RAND() mathematical-functions.html#function_rand CAST(RAND() as float) / 2147483648 RANDOM() RAND() RND() dbms_random.value (returns number >= 0 and < 1) dbms_random.value(37, 89) (returns a random number >= 37 and < 89.) RAND() 177610 RAND() RANDOMF() SQL%20Reference%20Guide/randomnumberfunctions.htm
Highest number in a list MAX(list) GREATEST(list) comparison-operators.html#function_greatest GREATEST(a, b) GREATEST(list) MAXVALUE(list) MAX(list) GREATEST(list) GREATEST(list)
Lowest number in a list MIN(list) LEAST(list) comparison-operators.html#function_least LEAST(a, b) LEAST(list) MINVALUE(list) MIN(list) LEAST(list) LEAST(list)
|}
Notes