Give output for:
SELECT ROUND(342.9234,-1);
Give output for:
SELECT ROUND(342.9234,-1);
Solution
A negative second argument in ROUND() rounds to the left of the decimal point. With , the number is rounded to the nearest ten.
The digit in the ones place of 342.9234 is 2, which is less than 5, so the tens digit stays the same:
Option 1: this is what ROUND(342.9234,1) would give. A positive value rounds after the decimal point, and a negative value rounds before it.
Option 3: this wrongly rounds up. The ones digit is 2, not 5 or more, so the tens digit 4 does not change.
Option 4: this is the result of ROUND(342.9234,-2), which rounds to the nearest hundred.
Related questions:
2025: 3 June Shift 2
2025: 13 May Shift 2
2025: 20 May Shift 1
2025: 14 May Shift 1