0
0
SQLquery~20 mins

ROUND, CEIL, FLOOR in SQL - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Master of ROUND, CEIL, FLOOR
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2: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;
A123.45
B123.46
C123.5
D124
Attempts:
2 left
💡 Hint
ROUND rounds the number to the specified decimal places.
query_result
intermediate
2: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;
A-3
B-4
C-3.7
D-2
Attempts:
2 left
💡 Hint
CEIL returns the smallest integer greater than or equal to the number.
query_result
advanced
2: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;
A6
B5
C7
D5.67
Attempts:
2 left
💡 Hint
ROUND first rounds 5.67 to 6, then FLOOR returns the largest integer less than or equal to 6.
📝 Syntax
advanced
2:00remaining
Identify the syntax error in CEIL usage
Which option contains a syntax error when using the CEIL function in SQL?
ASELECT CEIL(4.2) FROM dual;
BSELECT CEIL(-1.5);
CSELECT CEIL(4.2) AS ceil_val;
DSELECT CEIL 4.2 FROM dual;
Attempts:
2 left
💡 Hint
Functions require parentheses around their arguments.
🧠 Conceptual
expert
2:00remaining
Understanding FLOOR behavior with negative numbers
Which statement best describes the behavior of the FLOOR function when applied to negative decimal numbers?
AFLOOR rounds the number towards zero, so FLOOR(-2.3) returns -2.
BFLOOR returns the largest integer less than or equal to the number, so FLOOR(-2.3) returns -2.
CFLOOR returns the largest integer less than or equal to the number, so FLOOR(-2.3) returns -3.
DFLOOR always returns the absolute value of the number rounded down, so FLOOR(-2.3) returns 2.
Attempts:
2 left
💡 Hint
Think about the number line and what 'less than or equal' means for negative numbers.