Recall & Review
beginner
What does the ROUND function do in SQL?
ROUND rounds a numeric value to the nearest integer or to a specified number of decimal places.
Click to reveal answer
beginner
How does the CEIL function behave in SQL?
CEIL returns the smallest integer greater than or equal to the given number. It always rounds up.
Click to reveal answer
beginner
What is the purpose of the FLOOR function in SQL?
FLOOR returns the largest integer less than or equal to the given number. It always rounds down.
Click to reveal answer
beginner
How would you round the number 3.14159 to 2 decimal places using SQL?
Use ROUND(3.14159, 2) which returns 3.14.
Click to reveal answer
beginner
If you apply CEIL to 4.2 and FLOOR to 4.8, what are the results?
CEIL(4.2) returns 5, FLOOR(4.8) returns 4.
Click to reveal answer
What does ROUND(5.678, 1) return?
✗ Incorrect
ROUND(5.678, 1) rounds to one decimal place, so it returns 5.7.
Which function always rounds a number up to the nearest integer?
✗ Incorrect
CEIL always rounds up to the smallest integer greater than or equal to the number.
What is FLOOR(7.9)?
✗ Incorrect
FLOOR returns the largest integer less than or equal to 7.9, which is 7.
Which function would you use to round 2.5 to the nearest integer?
✗ Incorrect
ROUND rounds to the nearest integer, so ROUND(2.5) returns 3.
What does CEIL(-3.7) return?
✗ 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 SQL.
Think about how each function treats decimal numbers.
You got /3 concepts.
How would you use these functions to handle the number 5.3 in different ways?
Consider rounding up, down, or to nearest.
You got /3 concepts.