# SQL Numeric Functions

Function Parameters Result
SIN (θ) n = angle in radians sine (θ)
COS (θ) n = angle in radians cosine (θ)
TAN (θ) n = angle in radians tan (θ)
RADIANS(x) x = angle in degree Return value of x degree in radians
ASIN (θ) n is in the range -1 to +1 arc sine of θ in the range -π/2 to +π/2
ACOS (θ) θ is in the range -1 to +1 arc cosine of θ in the range 0 to π
ATAN (θ) θ is unbounded arc tangent of θ in the range -π/2 to + π/2
SINH (θ) θ = value hyperbolic sine of θ
COSH (θ) n = value hyperbolic cosine of θ
TANH (θ) θ = value hyperbolic tangent of θ
ABS (x) x = value Absolute value of x
MAX ( x ) x = column name Returns maximum value in a column
MIN ( x ) x = column name Returns minimum value in a column
MEDIAN ( x ) x = column name Returns middle value in a column
MOD ( x, y ) x = value, y = divisor Remainder of x/y
SUM ( x ) x = name of the column Returns SUM of all values in the column x
AVG ( x ) x = name of the column Returns average of all values in the column x
COALESCE ( x, y, z ) x, y, z = name of the columns Returns the first non-null values in the columns x
POWER ( x, y ) x = value, y = exponent xy
ROUND ( x [, n ] ) x = value, n = number of decimal places, default 0 x rounded to the nth decimal place
TRUNC ( x [, n ] ) x = value, n = number of decimal places, default 0 x truncated to the nth decimal place
SQRT ( x ) x = value + √x
STD(x) x = list of values Returns standard deviation of x
EXP ( x ) x = value ex
LN ( x ) x > 0 natural logarithm of x
LOG ( x2, x1 ) base x2 any positive value other than 0 or 1, x1 any positive value logx2x1
GREATEST ( x1, x2, x3,x4) ) x1, x2, x3, x4 = list of values gives greatest value in the list
LEAST ( x1, x2, x3,x4 ) x = value shows the least value in the list
CEIL ( x ) x = value smallest integer >= x
FLOOR ( x ) x = value greatest integer <= x
SIGN ( x ) x = value -1 if x < 0, 0 if x = 0, and 1 if x > 0

Examples:

SELECT SQRT (49) FROM DUAL;
Output:7
SELECT ROUND (10.6328, 3) FROM DUAL;
Output:10.632
SELECT POWER (5, 4) FROM DUAL;
Output:625
SELECT MOD (32, 5) FROM DUAL;
Output:2