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?
✗ Incorrect
SUNION returns the union of all members from the given sets.
What does
SINTER return when used on sets?✗ Incorrect
SINTER returns members that exist in every set provided.
If
set1 = {1, 2, 3} and set2 = {2, 4}, what does SDIFF set1 set2 return?✗ Incorrect
SDIFF returns members in set1 not in set2, so {1, 3}.
Which command would you use to find members that are in both
setA and setB?✗ Incorrect
SINTER finds the intersection (common members) of sets.
What will
SUNION return if one of the sets is empty?✗ Incorrect
SUNION returns all unique members from all sets, ignoring empty ones.
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.