Round Function Example and Usage in sql
In this article I am going to explain about the Round function in sql.How it will be working in sql and how to use Round function in sql(in my point of view).i have given some more examples here about the round functions.Please read and use it your application whenever it is required. Learn Round Function Example and Usage in sql
It is about Round Function Example and Usage in sql
Hai Friends,
First:Positive Number(it will be working left to right)
example:
select round(1234.5573,1)
The answer is 1234.6000.Second number is 5.it is Equal to 5 so,adding one to the previous number.ie)previous number is 5+adding one number=6 The Another example:
select round(1234.9573,1)
The answer is 1235.0000.Second number is 5.so,adding one to the previous number.ie)previous number is 9+adding one number=10.it is two digit number.so it will adding tens number(ie 1) to the given number(before the decimal number)ie.1234+1=1235
The Another example:
Ans:1234.5600select round(1234.5643,2)
Ans:1234.5700select round(1234.5653,2)
Ans:1234.5640select round(1234.5643,3)
Second:Positive Number(it will be working right to Left.it dont consider after the decimal numbers)
Which is Opposite to the Positive precision number.
Ans:1230.0000select round(1234.5373,-1)
First number is 4 which is less than 5,so it will round the number to zero.
Ans:1240.0000select round(1239.5573,-1)
First number is 9 which is Greater than 5,so it will round the number to 10.The ten's number one is added to the previous number.1239+1=1240
Ans:1230.0000select round(1234.9573,-1)
Ans:1240.0000select round(1235.9573,-1)
First number is 5 which is equal to 5,so it will round the number 5 to 10.The ten's number one is added to the previous number.1230+10=1240.0000
Ans:1200.0000select round(1234.5643,-2)
Ans:1200.0000select round(1234.5653,-2)
Ans:1000.0000select round(1234.5643,-3)
Third:precision number is zero
Ans:1235.0000select round(1234.5373,0)
Ans:1235.0000select round(1234.5973,0)
Ans:1240.0000select round(1239.9573,0)
Ans:1239.0000select round(1239.4643,0)
Thank you For reading my articles here.
if you have any queries please contact me in below mail and say your valuable comments here also.
Thank you.
My Mail Address is rathin59117@gmail.com
For more details, visit Rathin813.blogspot.com
Reference: http://rathin813.blogspot.com/
Hi Rathin,
1. It is really good information.
2. It provides all syntaxes related to the round function in sql