Skip to main contentSkip to solution

Consider the given two relations:

SPORTS :

S.NoNameClass
1Ajay5A
2Ankita6A
3Alok7A

MUSIC :

S.NoNameClass
1Abhay5A
2Ankita6A
3Mohit6A

What will be the result of SPORTS - MUSIC?

Solution

✅ Correct Option: 1

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 tupleIn MUSIC?In result?
(1, Ajay, 5A)No, MUSIC has (1, Abhay, 5A)Yes
(2, Ankita, 6A)Yes, identical tupleNo
(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.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question