Challenge - 5 Problems
ABS and MOD Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate1: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;
Attempts:
2 left
💡 Hint
ABS returns the positive value of a number.
✗ Incorrect
The ABS function returns the absolute value, so ABS(-15) is 15.
❓ query_result
intermediate1: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;
Attempts:
2 left
💡 Hint
MOD returns the remainder after division.
✗ Incorrect
29 divided by 5 is 5 with remainder 4, so MOD(29,5) is 4.
📝 Syntax
advanced1:30remaining
Identify the syntax error in MOD usage
Which option contains a syntax error in using the MOD function?
Attempts:
2 left
💡 Hint
Check the commas separating function arguments.
✗ Incorrect
Option A misses the comma between arguments, causing a syntax error.
❓ query_result
advanced1: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;
Attempts:
2 left
💡 Hint
MOD returns the remainder with the sign of the divisor in many SQL dialects.
✗ Incorrect
In standard SQL, MOD(-17,5) returns 3 because -17 = ( -4 * 5 ) + 3.
🧠 Conceptual
expert2:00remaining
Understanding ABS and MOD combined
Given the query:
What is the value of
SELECT ABS(MOD(-23, 7)) AS result;What is the value of
result?SQL
SELECT ABS(MOD(-23, 7)) AS result;
Attempts:
2 left
💡 Hint
Calculate MOD first, then apply ABS.
✗ Incorrect
MOD(-23,7) is 5 because -23 = (-4*7) + 5. Standard SQL returns 5. ABS(5) is 5.