0
0
SQLquery~20 mins

ABS and MOD functions in SQL - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
ABS and MOD Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
1:00remaining
Output of ABS function with negative input
What is the output of the following SQL query?

SELECT ABS(-15) AS result;
SQL
SELECT ABS(-15) AS result;
A15
B-15
C0
DNULL
Attempts:
2 left
💡 Hint
ABS returns the positive value of a number.
query_result
intermediate
1:00remaining
Output of MOD function with positive numbers
What is the output of this SQL query?

SELECT MOD(29, 5) AS remainder;
SQL
SELECT MOD(29, 5) AS remainder;
A1
B5
C0
D4
Attempts:
2 left
💡 Hint
MOD returns the remainder after division.
📝 Syntax
advanced
1:30remaining
Identify the syntax error in MOD usage
Which option contains a syntax error in using the MOD function?
ASELECT MOD(10 3) AS remainder;
BSELECT MOD(10, 3) AS remainder;
CSELECT MOD(10,3) AS remainder;
DSELECT MOD(10 % 3) AS remainder;
Attempts:
2 left
💡 Hint
Check the commas separating function arguments.
query_result
advanced
1:30remaining
Result of MOD with negative dividend
What is the output of this SQL query?

SELECT MOD(-17, 5) AS remainder;
SQL
SELECT MOD(-17, 5) AS remainder;
A-2
B3
C-3
D2
Attempts:
2 left
💡 Hint
MOD returns the remainder with the sign of the divisor in many SQL dialects.
🧠 Conceptual
expert
2:00remaining
Understanding ABS and MOD combined
Given the query:

SELECT ABS(MOD(-23, 7)) AS result;

What is the value of result?
SQL
SELECT ABS(MOD(-23, 7)) AS result;
A1
B-2
C5
D2
Attempts:
2 left
💡 Hint
Calculate MOD first, then apply ABS.