Recall & Review
beginner
What does the Redis command
ZRANGEBYSCORE do?It returns all the members in a sorted set with scores within a given range, ordered from lowest to highest score.
Click to reveal answer
intermediate
How do you specify the score range in
ZRANGEBYSCORE?You provide two arguments: the minimum score and the maximum score. You can use parentheses to exclude a boundary (e.g.,
(5 means greater than 5).Click to reveal answer
beginner
What does the syntax
ZRANGEBYSCORE key min max WITHSCORES return?It returns the members with scores between
min and max along with their scores.Click to reveal answer
intermediate
How can you limit the number of results returned by
ZRANGEBYSCORE?By adding the
LIMIT offset count option after the score range to return a subset of matching members.Click to reveal answer
beginner
Why is
ZRANGEBYSCORE useful in real-life applications?It helps retrieve items like top scores, events in a time range, or ranked data efficiently based on numeric scores.
Click to reveal answer
What does
ZRANGEBYSCORE myset 10 20 return?✗ Incorrect
ZRANGEBYSCORE returns members with scores between the min and max values, including both boundaries by default.
How do you exclude the minimum score 5 in
ZRANGEBYSCORE?✗ Incorrect
Using (5 means scores strictly greater than 5, excluding 5 itself.
Which option returns scores along with members?
✗ Incorrect
WITHSCORES tells Redis to return each member's score along with the member.
What does
LIMIT 0 3 do in ZRANGEBYSCORE?✗ Incorrect
LIMIT offset count returns count members starting from offset 0, so first 3 members.
Which data structure does
ZRANGEBYSCORE work on?✗ Incorrect
ZRANGEBYSCORE works on sorted sets, which store members with scores.
Explain how to use
ZRANGEBYSCORE to get members with scores between 50 and 100, including how to exclude the lower bound.Think about how to write the min argument to exclude 50.
You got /3 concepts.
Describe a real-life scenario where
ZRANGEBYSCORE would be helpful and how you would use it.Consider a game or event timeline.
You got /3 concepts.