Consider the given two relations:
SPORTS :
S.No Name Class 1 Ajay 5A 2 Ankita 6A 3 Alok 7A
MUSIC :
S.No Name Class 1 Abhay 5A 2 Ankita 6A 3 Mohit 6A
What will be the result of SPORTS - MUSIC?
Consider the given two relations:
SPORTS :
| S.No | Name | Class |
|---|---|---|
| 1 | Ajay | 5A |
| 2 | Ankita | 6A |
| 3 | Alok | 7A |
MUSIC :
| S.No | Name | Class |
|---|---|---|
| 1 | Abhay | 5A |
| 2 | Ankita | 6A |
| 3 | Mohit | 6A |
What will be the result of SPORTS - MUSIC?
Solution
SPORTS - MUSIC is the set difference. It returns the tuples that are in SPORTS but not in MUSIC. A tuple is removed only if all three attributes (S.No, Name, Class) match exactly.
| SPORTS tuple | In MUSIC? | In result? |
|---|---|---|
| (1, Ajay, 5A) | No, MUSIC has (1, Abhay, 5A) | Yes |
| (2, Ankita, 6A) | Yes, identical tuple | No |
| (3, Alok, 7A) | No, MUSIC has (3, Mohit, 6A) | Yes |
The result is (1, Ajay, 5A) and (3, Alok, 7A).
Option 2: it contains tuples from MUSIC (Abhay), so it is not SPORTS - MUSIC. It looks like part of MUSIC - SPORTS.
Option 3: this is MUSIC - SPORTS, the difference taken in the opposite order. Set difference is not commutative.
Option 4: it shows the common tuple (2, Ankita, 6A), which is the intersection, not the difference.
Related questions:
2025: 13 May Shift 2
2025: 3 June Shift 2
2026: 23 May Shift 1
2025: 14 May Shift 1
