0
0
Redisquery~10 mins

HINCRBY for numeric fields 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 increment the field 'score' by 1 in the hash 'player1'.

Redis
HINCRBY player1 score [1]
Drag options to blanks, or click blank then click option'
A-1
B1
CINCR
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string like 'INCR' instead of a number.
Using 0 which does not change the value.
Using a negative number when you want to increase.
2fill in blank
medium

Complete the code to decrease the field 'lives' by 2 in the hash 'game_stats'.

Redis
HINCRBY game_stats lives [1]
Drag options to blanks, or click blank then click option'
A-2
B2
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using positive 2 which increases the value.
Using 0 which does not change the value.
3fill in blank
hard

Fix the error in the command to increment 'points' by 5 in the hash 'user1'.

Redis
HINCRBY user1 points [1]
Drag options to blanks, or click blank then click option'
A'5'
Bfive
C5
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around the number.
Using words instead of numbers.
4fill in blank
hard

Fill both blanks to increment 'score' by 10 and decrement 'lives' by 1 in the hash 'player2'.

Redis
HINCRBY player2 score [1]
HINCRBY player2 lives [2]
Drag options to blanks, or click blank then click option'
A10
B-1
C1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using positive 1 instead of -1 for decrement.
Using 0 which does not change values.
5fill in blank
hard

Fill all three blanks to increment 'coins' by 15, decrement 'health' by 5, and increment 'level' by 2 in the hash 'game_data'.

Redis
HINCRBY game_data coins [1]
HINCRBY game_data health [2]
HINCRBY game_data level [3]
Drag options to blanks, or click blank then click option'
A5
B-5
C2
D15
Attempts:
3 left
💡 Hint
Common Mistakes
Using positive 5 instead of -5 for health decrement.
Mixing up the numbers for each field.