0
0
SQLquery~10 mins

ABS and MOD functions in SQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to get the absolute value of the column 'balance'.

SQL
SELECT [1](balance) FROM accounts;
Drag options to blanks, or click blank then click option'
AABS
BMOD
CROUND
DSUM
Attempts:
3 left
💡 Hint
Common Mistakes
Using MOD instead of ABS will return the remainder, not the absolute value.
Using SUM or ROUND does not change the sign of the number.
2fill in blank
medium

Complete the code to find the remainder when 'total' is divided by 5.

SQL
SELECT [1](total, 5) FROM sales;
Drag options to blanks, or click blank then click option'
AABS
BMOD
CROUND
DFLOOR
Attempts:
3 left
💡 Hint
Common Mistakes
Using ABS will give the absolute value, not the remainder.
ROUND and FLOOR change the number but do not give remainders.
3fill in blank
hard

Fix the error in the code to correctly get the absolute value of 'debt'.

SQL
SELECT [1](debt) FROM customers;
Drag options to blanks, or click blank then click option'
AMOD
BSUM
CABS
DAVG
Attempts:
3 left
💡 Hint
Common Mistakes
Missing closing parenthesis causes syntax error.
Using MOD instead of ABS returns remainder, not absolute value.
4fill in blank
hard

Fill both blanks to calculate the remainder of 'score' divided by 10 and get its absolute value.

SQL
SELECT [1]([2](score, 10)) FROM results;
Drag options to blanks, or click blank then click option'
AABS
BMOD
CROUND
DFLOOR
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing the order of functions causes errors.
Using ROUND or FLOOR instead of MOD for remainder.
5fill in blank
hard

Fill all three blanks to select the absolute value of the remainder when 'amount' is divided by 7, naming the result 'mod_result'.

SQL
SELECT [1]([2](amount, 7)) AS [3] FROM payments;
Drag options to blanks, or click blank then click option'
AABS
BMOD
Cmod_result
Dtotal
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong alias name causes confusion.
Swapping ABS and MOD changes meaning.