0
0
Redisquery~10 mins

Object storage with hashes 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 set a field 'name' with value 'Alice' in a Redis hash called 'user:1'.

Redis
HSET user:1 [1] Alice
Drag options to blanks, or click blank then click option'
Aname
Buser
Cvalue
Dfield
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'user' instead of the field name.
Confusing the field with the hash key.
2fill in blank
medium

Complete the code to get the value of the 'email' field from the Redis hash 'user:2'.

Redis
HGET user:2 [1]
Drag options to blanks, or click blank then click option'
Apassword
Bid
Cemail
Dusername
Attempts:
3 left
💡 Hint
Common Mistakes
Using the hash key instead of the field name.
Using a wrong field like 'username' or 'id'.
3fill in blank
hard

Fix the error in the code to delete the 'age' field from the Redis hash 'user:3'.

Redis
HDEL user:3 [1]
Drag options to blanks, or click blank then click option'
Auser:3
Bfield
Cdelete
Dage
Attempts:
3 left
💡 Hint
Common Mistakes
Using the hash key instead of the field name.
Using a command word like 'delete' as a field.
4fill in blank
hard

Fill both blanks to set the 'city' field to 'Paris' in the hash 'user:4' and then retrieve it.

Redis
HSET user:4 [1] Paris
HGET user:4 [2]
Drag options to blanks, or click blank then click option'
Acity
Bname
Dlocation
Attempts:
3 left
💡 Hint
Common Mistakes
Using different field names in set and get commands.
Using the hash key instead of the field name.
5fill in blank
hard

Fill all three blanks to create a hash 'user:5' with fields 'name' and 'age', then retrieve the 'age' field.

Redis
HSET user:5 [1] John [2] 30
HGET user:5 [3]
Drag options to blanks, or click blank then click option'
Aname
Bage
Dusername
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up field names or using wrong fields.
Trying to get a field that was not set.