0
0
MySQLquery~5 mins

ABS and MOD in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
A20
B-20
C0
DNULL
What is the result of MOD(14, 5) in MySQL?
A3
B2
C4
D1
Which function returns the remainder of division in MySQL?
AABS()
BMOD()
CROUND()
DCEIL()
What will SELECT MOD(10, 0); return in MySQL?
AError
B10
C0
DNULL
Which of these is true about ABS() in MySQL?
AIt returns the absolute value of a number.
BIt returns the remainder of division.
CIt can return negative values.
DIt rounds a number to the nearest integer.
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.