Q.The following query displays details of all those employees whose name consists of exactly 5 letters and starts with any letter but has 'ANYA' after that.
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →Concept understanding — Set Difference
Think of the guest list for a wedding and a separate list of people who have already sent their RSVP. The family wants to know who still has to be reminded. What they really want is: everyone on the guest list who is not on the RSVP list. That everyday act — starting with one group and striking off everyone who also belongs to another group — is the set difference.
The difference of two collections, taken as "first minus second", is a new collection containing exactly those items that appear in the first collection but do not appear in the second. Three details deserve attention:
- Only the first collection supplies candidates. Items that live only in the second collection are irrelevant to the result — they never get in.
- Anything the two collections share is removed. Shared items are precisely what gets struck off.
- Order matters. "A minus B" and "B minus A" are usually different results. Guests who have not replied is not the same list as repliers who were never invited.
That last point is the one students most often trip on, because with union and intersection the order of the two collections makes no difference, so it is tempting to assume difference behaves the same way. It does not.
Set difference is not symmetric. Before answering any question about a difference, fix clearly which collection is being kept and which is being subtracted — swapping them changes the answer completely. …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.