0
0
PostgreSQLquery~20 mins

Mathematical functions (ROUND, CEIL, FLOOR, ABS) in PostgreSQL - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Math Functions Master
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 this SQL query?
SELECT ROUND(12.3456, 2);
PostgreSQL
SELECT ROUND(12.3456, 2);
A12
B12.34
C12.35
D13
Attempts:
2 left
💡 Hint
ROUND rounds the number to the specified decimal places.
query_result
intermediate
2:00remaining
Output of CEIL function on negative decimal
What is the output of this SQL query?
SELECT CEIL(-3.7);
PostgreSQL
SELECT CEIL(-3.7);
A-3
B-4
C-3.7
D3
Attempts:
2 left
💡 Hint
CEIL returns the smallest integer greater than or equal to the number.
query_result
advanced
2:00remaining
Output of FLOOR function with positive decimal
What is the output of this SQL query?
SELECT FLOOR(7.999);
PostgreSQL
SELECT FLOOR(7.999);
A8
B7
C7.999
D0
Attempts:
2 left
💡 Hint
FLOOR returns the largest integer less than or equal to the number.
query_result
advanced
2:00remaining
Output of ABS function on negative integer
What is the output of this SQL query?
SELECT ABS(-15);
PostgreSQL
SELECT ABS(-15);
A15
B0
C-15
DNULL
Attempts:
2 left
💡 Hint
ABS returns the absolute value of the number.
🧠 Conceptual
expert
3:00remaining
Understanding combined use of ROUND, CEIL, FLOOR, and ABS
Given the query:
SELECT ROUND(CEIL(-2.3) + FLOOR(3.7) + ABS(-4.5), 0);

What is the output?
PostgreSQL
SELECT ROUND(CEIL(-2.3) + FLOOR(3.7) + ABS(-4.5), 0);
A7
B5
C-6
D6
Attempts:
2 left
💡 Hint
Calculate each function step-by-step before adding and rounding.