Recall & Review
beginner
What does the ABS function do in SQL?
The ABS function returns the absolute value of a number, which means it removes any negative sign and gives the positive value.
Click to reveal answer
beginner
What is the result of MOD(10, 3) in SQL?
MOD(10, 3) returns 1 because 10 divided by 3 leaves a remainder of 1.
Click to reveal answer
beginner
How can ABS and MOD functions be useful in real life?
ABS helps when you only want the size of a number, ignoring if it is negative, like distance. MOD helps find remainders, useful for things like checking if a number is even or odd.
Click to reveal answer
beginner
Write a SQL query to find the absolute value of -15.
SELECT ABS(-15) AS absolute_value;
Click to reveal answer
beginner
Write a SQL query to find the remainder when 29 is divided by 5.
SELECT MOD(29, 5) AS remainder;
Click to reveal answer
What does the ABS function return for ABS(-7)?
✗ Incorrect
ABS returns the positive value, so ABS(-7) is 7.
What is the result of MOD(14, 4)?
✗ Incorrect
14 divided by 4 leaves a remainder of 2, so MOD(14, 4) is 2.
Which SQL function would you use to get the remainder of a division?
✗ Incorrect
MOD returns the remainder after division.
What does ABS(0) return?
✗ Incorrect
The absolute value of 0 is 0.
If MOD(25, 5) is calculated, what is the result?
✗ Incorrect
25 divided by 5 has no remainder, so MOD(25, 5) is 0.
Explain what the ABS function does and give an example of when you might use it.
Think about how negative numbers can be turned positive.
You got /3 concepts.
Describe the MOD function and how it can help determine if a number is even or odd.
Consider dividing by 2 to check even or odd.
You got /3 concepts.