ROUND() Function in SQL Server

Learn via video course
FREE
View all courses
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
Topics Covered

Overview

This article is about SQL's ROUND function, syntax, parameters, and return type. It will also cover the features and applications of this function, along with suitable examples to help you understand better.

Transform Your Career

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program

What is ROUND() Function in SQL?

This function in SQL Server rounds off a given number to a specified number of decimal places. The SQL Query to round off a column to a specified decimal place would be like this -

We use SQL Round, Ceiling, and Floor functions to round the values to the nearest numbers. If we do not want to display decimal numbers in the application front end, that is when round() functions come into use.

It can round off the number according to the nearest number, whether we want to round it off on the decimal place or on the tens, hundreds place, etc.

Syntax

Below is the given syntax of the ROUND() function with the parameters required to run the SQL query and fetch the required result by rounding the number to specific decimal places.

Free Courses by top Scaler instructors
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science

Parameters

This function has three parameters - which has individual meaning as given below:

  1. NUMBER: The number which has to be rounded off.

  2. DECIMALS: Specified number of decimal places up to which the given number has to be rounded off.

  3. OPERATIONS: If its value is 0, it rounds the returned result to the number of the decimal. If the value is other than 0, it truncates the output to the number of decimals that are specified. This is an optional parameter, and the default value of this parameter is always 0.

Scaler Placement Report and Statistics

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

Return Type

It returns the number after rounding off to the specified places which are mentioned in the parameter.

For example - 36.4358 on rounding off after 2 decimal place would be 36.44.

The above SQL query would return 36.44

Features

  1. This function always returns the number after rounding off to the specified decimal places.

  2. This function accepts integers value, i.e. positive, negative, and zero-valued numbers.

  3. This function also accepts fraction numbers.

  4. This function rounds off a specified number to specified decimal places, which is mentioned in the parameter.

  5. This function works in SQL Server (starting with 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

Examples

Below are some examples where we are fetching results after applying the ROUND() function in an integer.

  • Example 1

Output

  • Example 2

Output

  • Example 3

Output

  • Example 4

Output

  • Example 5

Output

The ROUND() function can also be applied to the entire column in a table. Some examples are explained below:


Employee Table:

NameEmployee IdYearly Bonus
Aman6915020.96
Harsh7033591.32
Yash3457080.10

On running the SQL Query

The resulting table would look like this -

Yearly Bonus
5021.00
3591.00
7080.00

Student Table:

NameStudent IdAvg Marks
Punit190.34
Aryan279.67
Sonu370.83

On running the SQL Query

The resulting table would look like this -

Student IdAvg Marks
190.3
279.7
370.8

Patient_Details Table:

NamePatient IdWeight
Sumit183.650
Rohan276.669
Rahul375.332

On running the SQL Query:

The resulting table would look like this -

NamePatient IdWeight
Sumit184.000
Rohan277.000
Rahul375.000

Application of ROUND() Function in SQL

This function returns the number after rounding off to the specified places. The ROUND() function can fetch us a rounded result to specified decimal places and round off the entire column in a table using SQL Query.

Conclusions

  1. ROUND() function is used to round off a given number to specified decimal places.

  2. The name of the function is ROUND, which takes two or three parameters depending on the kind of result we want to fetch.

  3. This ROUND() function is kind of similar to the ceiling or floor functions of SQL.

  4. If the operational(third) parameter is 0 (or not provided in the function), the ROUND() function will round the result to the number of specified decimal places.

  5. If the operation parameter is non-zero, then the ROUND() function will truncate the result to the number of specified decimal places.