0
0
SQLquery~5 mins

ABS and MOD functions in SQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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)?
A-7
BNULL
C0
D7
What is the result of MOD(14, 4)?
A4
B0
C2
D3
Which SQL function would you use to get the remainder of a division?
AABS
BMOD
CSUM
DAVG
What does ABS(0) return?
A0
B-0
CNULL
D1
If MOD(25, 5) is calculated, what is the result?
A0
B5
C1
D25
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.