0
0
Redisquery~10 mins

INCRBY and DECRBY in Redis - Interactive Code Practice

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

Complete the code to increase the value of the key 'counter' by 5.

Redis
INCRBY counter [1]
Drag options to blanks, or click blank then click option'
A5
B10
C-5
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using a negative number with INCRBY to increase the value.
Forgetting to specify the increment value.
2fill in blank
medium

Complete the code to decrease the value of the key 'score' by 3.

Redis
DECRBY score [1]
Drag options to blanks, or click blank then click option'
A3
B5
C-3
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using a negative number with DECRBY to decrease the value.
Confusing DECRBY with INCRBY.
3fill in blank
hard

Fix the error in the code to correctly increase the key 'visits' by 7.

Redis
INCRBY visits [1]
Drag options to blanks, or click blank then click option'
A-7
Bseven
C7
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using a word instead of a number for the increment.
Using a negative number with INCRBY.
4fill in blank
hard

Fill both blanks to decrease the key 'balance' by 15 and increase the key 'debt' by 15.

Redis
DECRBY balance [1]
INCRBY debt [2]
Drag options to blanks, or click blank then click option'
A15
B10
C5
D20
Attempts:
3 left
💡 Hint
Common Mistakes
Using different amounts for the two commands.
Using negative numbers with DECRBY or INCRBY incorrectly.
5fill in blank
hard

Fill all three blanks to increase 'likes' by 8, decrease 'dislikes' by 3, and increase 'comments' by 5.

Redis
INCRBY likes [1]
DECRBY dislikes [2]
INCRBY comments [3]
Drag options to blanks, or click blank then click option'
A3
B8
C5
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the amounts for each key.
Using negative numbers with DECRBY or INCRBY incorrectly.