0% found this document useful (0 votes)
6 views1 page

T2 - Number Functions

The document explains three SQL functions: ROUND, TRUNC, and MOD. The ROUND function adjusts numerical precision by rounding values to specified decimal places, while TRUNC truncates numbers to a defined number of decimal places. The MOD function calculates the remainder from a division operation.

Uploaded by

Fahad Ahamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

T2 - Number Functions

The document explains three SQL functions: ROUND, TRUNC, and MOD. The ROUND function adjusts numerical precision by rounding values to specified decimal places, while TRUNC truncates numbers to a defined number of decimal places. The MOD function calculates the remainder from a division operation.

Uploaded by

Fahad Ahamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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)

You might also like