Challenge - 5 Problems
Master of ROUND, CEIL, FLOOR
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
Output of ROUND function with decimal places
What is the output of the following SQL query?
SELECT ROUND(123.4567, 2) AS rounded_value;SQL
SELECT ROUND(123.4567, 2) AS rounded_value;
Attempts:
2 left
💡 Hint
ROUND rounds the number to the specified decimal places.
✗ Incorrect
ROUND(123.4567, 2) rounds the number to 2 decimal places, so 123.4567 becomes 123.46.
❓ query_result
intermediate2:00remaining
Output of CEIL function on a negative decimal
What is the output of this SQL query?
SELECT CEIL(-3.7) AS ceil_value;SQL
SELECT CEIL(-3.7) AS ceil_value;
Attempts:
2 left
💡 Hint
CEIL returns the smallest integer greater than or equal to the number.
✗ Incorrect
CEIL(-3.7) returns -3 because -3 is the smallest integer greater than or equal to -3.7.
❓ query_result
advanced2:00remaining
Combining FLOOR and ROUND functions
What is the output of this SQL query?
SELECT FLOOR(ROUND(5.67, 0)) AS result_value;SQL
SELECT FLOOR(ROUND(5.67, 0)) AS result_value;
Attempts:
2 left
💡 Hint
ROUND first rounds 5.67 to 6, then FLOOR returns the largest integer less than or equal to 6.
✗ Incorrect
ROUND(5.67, 0) rounds to 6, and FLOOR(6) returns 6.
📝 Syntax
advanced2:00remaining
Identify the syntax error in CEIL usage
Which option contains a syntax error when using the CEIL function in SQL?
Attempts:
2 left
💡 Hint
Functions require parentheses around their arguments.
✗ Incorrect
Option D is missing parentheses around the argument, causing a syntax error.
🧠 Conceptual
expert2:00remaining
Understanding FLOOR behavior with negative numbers
Which statement best describes the behavior of the FLOOR function when applied to negative decimal numbers?
Attempts:
2 left
💡 Hint
Think about the number line and what 'less than or equal' means for negative numbers.
✗ Incorrect
FLOOR returns the largest integer less than or equal to the input. For -2.3, the largest integer less than or equal is -3.