0
0
Redisquery~10 mins

Range queries for scoring 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 50 and 100.

Redis
ZRANGEBYSCORE myset [1] 100
Drag options to blanks, or click blank then click option'
A-inf
B0
C100
D50
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 instead of 50 as the minimum score.
Using 100 as the minimum score which would return only scores >= 100.
2fill in blank
medium

Complete the code to get all members with scores less than or equal to 75.

Redis
ZRANGEBYSCORE myset [1] 75
Drag options to blanks, or click blank then click option'
A-inf
B0
C75
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as minimum score, which excludes negative scores if any.
Using 75 as minimum score, which returns only scores >= 75.
3fill in blank
hard

Fix the error in the code to get members with scores between 20 and 40 inclusive.

Redis
ZRANGEBYSCORE myset 20 [1]
Drag options to blanks, or click blank then click option'
A50
B20
C40
D-inf
Attempts:
3 left
💡 Hint
Common Mistakes
Using 20 as maximum score which returns only scores <= 20.
Using 50 which includes scores beyond 40.
4fill in blank
hard

Fill both blanks to get members with scores strictly greater than 30 and less than or equal to 60.

Redis
ZRANGEBYSCORE myset [1] [2]
Drag options to blanks, or click blank then click option'
A(30
B30
C60
D(60
Attempts:
3 left
💡 Hint
Common Mistakes
Using 30 instead of (30, which includes 30.
Using (60 which excludes 60.
5fill in blank
hard

Fill all three blanks to get members with scores strictly between 10 and 90, and limit the result to 5 members.

Redis
ZRANGEBYSCORE myset [1] [2] LIMIT 0 [3]
Drag options to blanks, or click blank then click option'
A(10
B90
C5
D(90
Attempts:
3 left
💡 Hint
Common Mistakes
Using 10 or 90 without parentheses includes those scores.
Not using LIMIT or wrong count value.