0
0
PostgreSQLquery~10 mins

Mathematical functions (ROUND, CEIL, FLOOR, ABS) in PostgreSQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to round the number 3.14159 to the nearest integer.

PostgreSQL
SELECT [1](3.14159);
Drag options to blanks, or click blank then click option'
AFLOOR
BROUND
CCEIL
DABS
Attempts:
3 left
💡 Hint
Common Mistakes
Using CEIL or FLOOR instead of ROUND will always round up or down, not to the nearest integer.
Using ABS returns the absolute value, not rounding.
2fill in blank
medium

Complete the code to get the smallest integer greater than or equal to 4.3.

PostgreSQL
SELECT [1](4.3);
Drag options to blanks, or click blank then click option'
AABS
BROUND
CFLOOR
DCEIL
Attempts:
3 left
💡 Hint
Common Mistakes
Using FLOOR will round down instead of up.
Using ROUND may round down if decimal part is less than 0.5.
3fill in blank
hard

Fix the error in the code to get the largest integer less than or equal to 7.8.

PostgreSQL
SELECT [1](7.8);
Drag options to blanks, or click blank then click option'
AROUND
BABS
CFLOOR
DCEIL
Attempts:
3 left
💡 Hint
Common Mistakes
Using CEIL will round up instead of down.
Using ROUND may round up or down depending on decimal part.
4fill in blank
hard

Fill both blanks to calculate the absolute value of -15 and then round it.

PostgreSQL
SELECT [1]([2](-15));
Drag options to blanks, or click blank then click option'
AROUND
BCEIL
CABS
DFLOOR
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of functions will cause errors or wrong results.
Using CEIL or FLOOR instead of ABS will not remove the negative sign.
5fill in blank
hard

Fill all three blanks to round the absolute value of -3.7 up to the nearest integer.

PostgreSQL
SELECT [1]([2]([3]));
Drag options to blanks, or click blank then click option'
AROUND
BCEIL
CABS
D-3.7
Attempts:
3 left
💡 Hint
Common Mistakes
Using ROUND instead of CEIL will round 3.7 to 4 but not always up.
Not using ABS will keep the negative sign and affect rounding.