In order to round off a numeric field in a table that contains decimals, the ROUND() function is used.

The numbers will be rounded to the nearest whole number.

 

SQL ROUND() Syntax is as follows:

Select Round(column_name, decimals)

From table_name;

 

Here, decimals mention the number of decimals that are to be returned.

 

Let us consider the below Students table:

roll_no

Name

total_marks

(out of 600)

percentage

grade

1

Ashok

392

65.33

B

2

Chaitali

454

75.67

A

3

Smriti

502

83.60

A

4

Kaushik

337

56.10

C

 

If we want to round of the percentage column, then we can use the following statement:

Select name, Round(percentage,0)

From Students;

 

The result will be as follows:

Name

percentage

Ashok

65

Chaitali

76

Smriti

84

Kaushik

56