Published on: 02 September, 2013

SQL ROUND() Function

Tumblr Digg Google Plus

The SQL ROUND() function is used to return the round a numeric value. You can specify how many decimal number you want to round.

Example Customer Table

The following data table is for example only. Let's use ROUND() function to round the value of Points from a customer table. The column we going to use is the Points column.

ID Name Age Points
1 Thomas Anderson 45 2.567
2 Andrew Golden 38 3.125
3 Ken Tom 30 4.669
4 Andrew Golden 36 5.321
5 Timonthy Kirk 32 6.878
6 Kelly Smith 39 8.652

Example of Running SQL Query

SELECT ID, Name, Age, ROUND(Points, 2) AS Round_Value
FROM   Customers

After running the above query, it will return the following result.

ID Name Age Round_Value
1 Thomas Anderson 45 2.56
2 Andrew Golden 38 3.12
3 Ken Tom 30 4.66
4 Andrew Golden 36 5.32
5 Timonthy Kirk 32 6.87
6 Kelly Smith 39 8.65

Comments

There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.