Number Functions
1. ROUND () Function
The ROUND function is a fundamental tool that adjusts the precision of numerical data in SQL. It rounds
values to a specified number of decimal places and simplifies data for analysis. For example, with SQL ROUND,
you can change a number like 3.14159 to 3.14 by rounding it to two decimal places. This is helpful when exact
precision is unnecessary and rounded figures are sufficient for interpretation.
Syntax : ROUND(number, decimal_place)
Q.Write output of below SQL Statements.
a. ROUND(45.926)
b. ROUND(45.926,0)
c. ROUND(45.926,2)
d. ROUND(45.926,-1)
2. The TRUNC (number) function returns n1 truncated to n2 decimal places. If n2 is omitted, then n1 is
truncated to 0 places. n2 can be negative to truncate (make zero) n2 digits left of the decimal point.
Syntax : TRUNC(number, decimal_place)
Q. Write output of below SQL Statements
a. TRUNC(45.926,2)
b. TRUNC(45.926,0)
c. TRUNC(45.926)
3. MOD () Function
Mod is a mathematical function that returns the remainder, or modulus, from a division.
Syntax: MOD(dividend, divisor)
Q. Write output of below SQL Statements
a. MOD(400,20)
b. MOD(450,8)
c. MOD(96,12)