Recall & Review
beginner
What does the ABS() function do in MySQL?
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 MySQL?
MOD(10, 3) returns 1 because 10 divided by 3 leaves a remainder of 1.
Click to reveal answer
intermediate
How does MOD() differ from the % operator in MySQL?
MOD() and % both return the remainder of division, but MOD() is a function and can handle NULL values gracefully, while % is an operator.
Click to reveal answer
beginner
Write a MySQL query to get the absolute value of -15.
SELECT ABS(-15); -- This returns 15
Click to reveal answer
beginner
Write a MySQL query to find the remainder when 25 is divided by 4.
SELECT MOD(25, 4); -- This returns 1
Click to reveal answer
What does ABS(-20) return in MySQL?
✗ Incorrect
ABS() returns the positive value of the number, so ABS(-20) is 20.
What is the result of MOD(14, 5) in MySQL?
✗ Incorrect
14 divided by 5 leaves a remainder of 4, so MOD(14, 5) returns 4.
Which function returns the remainder of division in MySQL?
✗ Incorrect
MOD() returns the remainder after division.
What will SELECT MOD(10, 0); return in MySQL?
✗ Incorrect
MOD() with divisor 0 returns NULL because division by zero is undefined.
Which of these is true about ABS() in MySQL?
✗ Incorrect
ABS() returns the absolute (positive) value of a number.
Explain how the ABS() function works in MySQL and give an example.
Think about how you find the distance from zero on a number line.
You got /3 concepts.
Describe what the MOD() function does and how it is used in MySQL.
Think about how you find what is left after dividing.
You got /3 concepts.