NUMBER FUNCTIONS IN SQL

•ROUND (column / expr, [n])
– Round the columns or expression to n decimal places.
e.g.
– ROUND (45.475, 2) = 45.48
– ROUND (45.475, 0) = 45
– ROUND (45.475, -1) = 50 (rounding takes place to the left side of the decimal place)

•TRUNC (column / expr, [n])
– Truncate the column or expression to n decimal places.
e.g.
–TRUNC (45.475, 2) = 45.47
– TRUNC (45.475, 0) = 45
–TRUNC (45.475, -1) = 40 (truncation takes place to the left side of the decimal place)


•POWER( n, p)
–Returns n raised to the power p.
e.g.
– POWER (2, 4) = 16
•ABS (n)
–Returns the absolute value of n.
e.g.
– ABS(-1) = 1
•MOD (x, y)
– Return the integer remainder of x/y.
e.g.
–MOD (5, 2) = 1
–MOD( 3, 5) = 3
–MOD ( 6, 3) = 0
Post a Comment