Recall & Review
beginner
What does the ROUND() function do in MySQL?
The ROUND() function rounds a number to the nearest integer or to a specified number of decimal places.
Click to reveal answer
beginner
How does the CEIL() function behave?
CEIL() returns the smallest integer greater than or equal to the given number. It rounds numbers up.
Click to reveal answer
beginner
What is the purpose of the FLOOR() function?
FLOOR() returns the largest integer less than or equal to the given number. It rounds numbers down.
Click to reveal answer
beginner
How do you round the number 3.14159 to 2 decimal places using ROUND()?
Use ROUND(3.14159, 2) which returns 3.14.
Click to reveal answer
intermediate
What will CEIL(-2.3) and FLOOR(-2.3) return?
CEIL(-2.3) returns -2 (rounds up), FLOOR(-2.3) returns -3 (rounds down).
Click to reveal answer
What does ROUND(4.567, 1) return?
✗ Incorrect
ROUND(4.567, 1) rounds to 1 decimal place, so it returns 4.6.
Which function rounds a number up to the nearest integer?
✗ Incorrect
CEIL() always rounds numbers up to the nearest integer.
What does FLOOR(7.9) return?
✗ Incorrect
FLOOR(7.9) returns the largest integer less than or equal to 7.9, which is 7.
If you want to round 5.678 to the nearest integer, which function do you use?
✗ Incorrect
ROUND() rounds to the nearest integer by default.
What is the result of CEIL(-3.7)?
✗ Incorrect
CEIL(-3.7) returns the smallest integer greater than or equal to -3.7, which is -3.
Explain the difference between ROUND(), CEIL(), and FLOOR() functions in MySQL.
Think about how each function treats decimal parts of numbers.
You got /3 concepts.
How would you use ROUND() to round a number to 3 decimal places? Give an example.
The second argument in ROUND controls decimal places.
You got /2 concepts.