0
0
Redisquery~5 mins

Range queries for scoring in Redis - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What Redis data structure is commonly used for range queries based on scores?
Redis Sorted Sets are used for range queries based on scores because they store members ordered by their score values.
Click to reveal answer
beginner
Which Redis command retrieves members with scores between a minimum and maximum value?
The command ZRangeByScore retrieves members with scores within a specified range.
Click to reveal answer
intermediate
How do you include the scores in the results when performing a range query in Redis?
Use the WITHSCORES option with ZRangeByScore to get both members and their scores.
Click to reveal answer
intermediate
What symbol do you use in Redis range queries to represent negative or positive infinity?
Use -inf for negative infinity and +inf for positive infinity to specify open-ended ranges.
Click to reveal answer
intermediate
How can you limit the number of results returned by a Redis range query?
Use the LIMIT offset count option with ZRangeByScore to restrict the number of returned members.
Click to reveal answer
Which Redis command fetches members with scores between 10 and 20?
AZSCORE key 10 20
BZRANGE key 10 20
CZRANGEBYSCORE key 10 20
DZGETRANGE key 10 20
How do you get the scores along with members in a range query?
AAdd WITHSCORES option
BAdd GETSCORES option
CAdd SHOWSCORES option
DAdd SCORES option
What does -inf mean in a Redis range query?
AZero score
BNegative infinity, lowest possible score
CPositive infinity, highest possible score
DNo score
Which option limits the number of results in ZRangeByScore?
ALIMIT offset count
BCOUNT offset limit
CMAX offset count
DOFFSET limit count
If you want all members with scores greater than or equal to 50, what is the correct range?
A-inf +inf
B-inf 50
C0 50
D50 +inf
Explain how to perform a range query in Redis to get members with scores between two values, including how to get their scores and limit results.
Think about the command and options you add for scores and limits.
You got /4 concepts.
    Describe the meaning and use of -inf and +inf in Redis range queries.
    They help when you want to query from or up to any score.
    You got /3 concepts.