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 decimals
What is the output of the following MySQL query?
SELECT ROUND(12.3456, 2) AS rounded_value;MySQL
SELECT ROUND(12.3456, 2) AS rounded_value;
Attempts:
2 left
💡 Hint
ROUND rounds the number to the specified decimal places.
✗ Incorrect
ROUND(12.3456, 2) rounds the number to 2 decimal places, so 12.3456 becomes 12.35.
❓ query_result
intermediate2:00remaining
Output of CEIL function with negative decimal
What is the output of this MySQL query?
SELECT CEIL(-3.7) AS ceil_value;MySQL
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
Output of FLOOR function with positive decimal
What is the output of this MySQL query?
SELECT FLOOR(7.999) AS floor_value;MySQL
SELECT FLOOR(7.999) AS floor_value;
Attempts:
2 left
💡 Hint
FLOOR returns the largest integer less than or equal to the number.
✗ Incorrect
FLOOR(7.999) returns 7 because 7 is the largest integer less than or equal to 7.999.
🧠 Conceptual
advanced2:00remaining
Difference between CEIL and FLOOR for negative numbers
Which statement correctly describes the difference between CEIL and FLOOR functions when applied to negative decimal numbers in MySQL?
Attempts:
2 left
💡 Hint
Think about how CEIL and FLOOR behave on negative decimals.
✗ Incorrect
CEIL returns the smallest integer greater than or equal to the number, which for negative numbers means rounding up towards zero. FLOOR returns the largest integer less than or equal to the number, which means rounding down away from zero.
📝 Syntax
expert2:00remaining
Identify the syntax error in ROUND usage
Which option contains a syntax error when using the ROUND function in MySQL?
Attempts:
2 left
💡 Hint
Check the syntax for function arguments and commas.
✗ Incorrect
Option A is missing a comma between the number and the decimal places, causing a syntax error.