ROUND(X,D); // X : Argument , D: Number of decimal placesWe can get rounded data by using round sql query. Here is an example
Rounding off data up to 2 decimal places .
Examples with different number of decimal place.
Using negative value for Number of decimal places.
SELECT ROUND(234.96,-1); // Output is 230 SELECT ROUND(236.96,-1); // Output is 240 SELECT ROUND(3463.4896,-2); // Output is 3500Negative value for decimal place ( D) will affect left of decimal places.
We will use our student table and get the rounded data by using round query.
Percentage is a column name in our student table. Here we store the percentage value of each student mark. One of our student Max has got 79.2982 percentage. This number we can round off and display without any decimal value by using command like this.
Inside round function we can change the number of decimal places required to 1,2,3 etc .. here is an example.
Output is here
SQL dump of Student4 table here
This article is written by plus2net.com team.