Did you find this useful?
Socialize it today.

SQL ROUND Function

Wednesday, December 14, 2011

tags SQL

The SQL ROUND function is used to round a numeric field in a table to the number of decimals specified.

Employees Table

1000John Smith10.25
1001Fred White22.53
1002Jane Scott17.4
1003Samuel Williams9.9

In this example, we want to round the results of the yearsOfService to the nearest whole number.


SELECT ROUND(column_name, decimals)
FROM Table

SELECT employeeName as [Employee Name], ROUND(yearsofService,0) as [Years of Service]
FROM employees


Employee NameYears of Service
John Smith10
Fred White23
Jane Scott17
Samuel Williams10

The SQL ROUND function is very useful when you need to round the numbers in the result set to a specific number of decimal places.

Please help us spread the word by socializing it today!

email contact us

Did you find something wrong with the information on this page? Please take a moment to report it to us so that we can continue to improve the quality of the information on this site. Click here to report an issue with this page.

Recommended Books & Training Resources

SQL Cookbook Head First SQL: Your Brain on SQL A Learners Guide