0
0
Redisquery~10 mins

ZRANGEBYSCORE for score-based queries 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 get all members with scores between 10 and 20.

Redis
ZRANGEBYSCORE mysortedset [1] 20
Drag options to blanks, or click blank then click option'
A10
B5
C30
D-inf
Attempts:
3 left
💡 Hint
Common Mistakes
Using a score lower than 10 will include unwanted members.
Using a string instead of a number for the score.
2fill in blank
medium

Complete the code to get members with scores greater than or equal to 15.

Redis
ZRANGEBYSCORE mysortedset [1] +inf
Drag options to blanks, or click blank then click option'
A15
B(15
C-inf
D20
Attempts:
3 left
💡 Hint
Common Mistakes
Using (15 excludes score 15 itself.
Using -inf will include all scores.
3fill in blank
hard

Fix the error in the code to exclude members with score 10 but include scores above 10.

Redis
ZRANGEBYSCORE mysortedset [1] 20
Drag options to blanks, or click blank then click option'
A[10
B10
C(10
D-inf
Attempts:
3 left
💡 Hint
Common Mistakes
Using 10 includes score 10.
Using [10 is invalid syntax.
4fill in blank
hard

Fill both blanks to get members with scores strictly between 5 and 15.

Redis
ZRANGEBYSCORE mysortedset [1] [2]
Drag options to blanks, or click blank then click option'
A(5
B5
C(15
D15
Attempts:
3 left
💡 Hint
Common Mistakes
Using 5 or 15 includes those scores.
Using brackets [ ] is invalid in Redis score ranges.
5fill in blank
hard

Fill all three blanks to get members with scores from 0 (inclusive) to 100 (exclusive), limiting to 10 results starting from the second member (offset 1).

Redis
ZRANGEBYSCORE mysortedset [1] [2] LIMIT [3] 10
Drag options to blanks, or click blank then click option'
A0
B100
C(100
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 100 includes score 100.
Using LIMIT 0 10 starts from first member, not second.
Using 0 as offset starts from the first member.