0
0
Redisquery~5 mins

SUNION, SINTER, SDIFF set operations in Redis - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the Redis command SUNION do?
It returns all the unique members from all the given sets combined, like gathering all friends from different groups without repeats.
Click to reveal answer
beginner
Explain the Redis command SINTER in simple terms.
It finds the common members that exist in all the given sets, like finding friends who are in every group you belong to.
Click to reveal answer
beginner
What is the purpose of the Redis command SDIFF?
It returns members from the first set that are not in the other sets, like finding friends unique to your first group and not in others.
Click to reveal answer
beginner
If you run SUNION set1 set2 and set1 has {a, b} and set2 has {b, c}, what is the result?
The result is {a, b, c} because SUNION combines all unique members from both sets.
Click to reveal answer
beginner
What will SINTER set1 set2 return if set1 = {x, y, z} and set2 = {y, z, w}?
It will return {y, z} because those members are common to both sets.
Click to reveal answer
Which Redis command returns all unique members from multiple sets combined?
ASDIFF
BSINTER
CSUNION
DSMEMBERS
What does SINTER return when used on sets?
AMembers common to all sets
BAll members from all sets combined
CThe size of the sets
DMembers unique to the first set
If set1 = {1, 2, 3} and set2 = {2, 4}, what does SDIFF set1 set2 return?
A{1, 3}
B{1, 2, 3, 4}
C{2}
D{}
Which command would you use to find members that are in both setA and setB?
ASUNION setA setB
BSINTER setA setB
CSDIFF setA setB
DSADD setA setB
What will SUNION return if one of the sets is empty?
AMembers only from the empty set
BAn empty set
CError
DOnly members from the non-empty sets
Describe in your own words what the Redis commands SUNION, SINTER, and SDIFF do with sets.
Think about combining friends from groups, common friends, and unique friends.
You got /3 concepts.
    Give a real-life example to explain when you would use SUNION, SINTER, and SDIFF in Redis.
    Imagine groups of friends or shopping lists.
    You got /3 concepts.