Challenge - 5 Problems
HDEL Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
What is the result of this HDEL command?
Given a Redis hash stored as
user:1000 with fields name, email, and age, what does the command HDEL user:1000 email return?Redis
HDEL user:1000 emailAttempts:
2 left
💡 Hint
HDEL returns the number of fields it successfully removed.
✗ Incorrect
HDEL returns 1 if the specified field existed and was removed, otherwise 0.
❓ query_result
intermediate2:00remaining
What happens if you try to remove a non-existing field?
If the Redis hash
session:123 has fields token and expiry, what does HDEL session:123 user return?Redis
HDEL session:123 userAttempts:
2 left
💡 Hint
HDEL returns how many fields it removed, zero if none.
✗ Incorrect
Since 'user' field does not exist, HDEL returns 0.
📝 Syntax
advanced2:00remaining
Which HDEL command syntax is correct to remove multiple fields?
You want to remove fields
name and email from the hash user:2000. Which command is valid?Attempts:
2 left
💡 Hint
HDEL accepts multiple fields as separate arguments.
✗ Incorrect
The correct syntax lists fields separated by spaces without brackets or quotes.
❓ optimization
advanced2:00remaining
How to efficiently remove multiple fields from a large hash?
You have a large Redis hash
config:settings with many fields. You want to remove 100 specific fields. Which approach is best?Attempts:
2 left
💡 Hint
HDEL accepts multiple fields in one call, reducing network overhead.
✗ Incorrect
Calling HDEL once with all fields is efficient and reduces round-trips.
🧠 Conceptual
expert2:00remaining
What is the effect of HDEL on a hash when all fields are removed?
If you remove all fields from a Redis hash using HDEL, what happens to the hash key itself?
Attempts:
2 left
💡 Hint
Empty hashes are automatically deleted by Redis.
✗ Incorrect
Redis automatically deletes the hash key when the last field is removed (EXISTS returns 0).