Recall & Review
beginner
What does the ROUND function do in PostgreSQL?
The ROUND function rounds a numeric value to the nearest whole number or to a specified number of decimal places.
Click to reveal answer
beginner
How does the CEIL function behave in PostgreSQL?
The CEIL (ceiling) function returns the smallest integer greater than or equal to the given number.
Click to reveal answer
beginner
Explain the FLOOR function in PostgreSQL.
The FLOOR function returns the largest integer less than or equal to the given number.
Click to reveal answer
beginner
What is the purpose of the ABS function in PostgreSQL?
The ABS function returns the absolute value of a number, which means it removes any negative sign and returns a positive number or zero.
Click to reveal answer
beginner
Which function would you use to round 3.14159 to 2 decimal places in PostgreSQL?
You would use ROUND(3.14159, 2) which returns 3.14.
Click to reveal answer
What does CEIL(4.3) return in PostgreSQL?
✗ Incorrect
CEIL returns the smallest integer greater than or equal to the number, so CEIL(4.3) is 5.
Which function returns the largest integer less than or equal to a number?
✗ Incorrect
FLOOR returns the largest integer less than or equal to the input number.
What is the result of ABS(-7) in PostgreSQL?
✗ Incorrect
ABS returns the positive value of the number, so ABS(-7) is 7.
How does ROUND(5.678, 1) evaluate?
✗ Incorrect
ROUND rounds to the specified decimal place, so 5.678 rounded to 1 decimal place is 5.7.
Which function would you use to get the integer part of 9.99 by rounding down?
✗ Incorrect
FLOOR rounds down to the nearest integer, so FLOOR(9.99) returns 9.
Describe the difference between CEIL and FLOOR functions in PostgreSQL.
Think about rounding numbers up or down.
You got /3 concepts.
Explain how you would use the ROUND function to round a number to 3 decimal places.
ROUND(number, decimal_places)
You got /3 concepts.