What will be the ouput of following query?
SELECT ROUND(3.144, 1);
What will be the ouput of following query?
SELECT ROUND(3.144, 1);
Solution
✅ Correct Option: 3
ROUND(number, d) rounds the number to d decimal places. Here d = 1, so only one digit is kept after the decimal point.
The digit after the first decimal place is 4, which is less than 5, so the 1 stays as it is and the result is 3.1.
Option 1: 3.2 would need the next digit to be 5 or more, but it is 4.
Option 2: 3.14 is what ROUND(3.144, 2) gives, since that keeps two decimal places.
A negative second argument rounds digits to the left of the decimal point, e.g. ROUND(135, -1) gives 140.
Related questions:
2025: 21 May Shift 1
2025: 22 May Shift 1
2025: 14 May Shift 1