Skip to main contentSkip to solution

Consider the following two tables:

DANCE:

SNoNameClass
1Aastha7A
2Mahira6A
3Mohit7B
4Sanjay7A

MUSIC:

SNoNameClass
1Mehak8A
2Mahira6A
3Lavanya7A
4Sanjay7A
5Abhay8A

Arrange the following operations when performed on the above two tables, in the increasing order of their cardinality in the corresponding result set.

A. DANCE U MUSIC

B. DANCE ∩ MUSIC

C. MUSIC - DANCE

D. DANCE X MUSIC

Solution

✅ Correct Option: 1

Two tuples are the same only if all their attributes match. The common tuples are (2, Mahira, 6A) and (4, Sanjay, 7A).

OperationWorkingCardinality
B. DANCE ∩ MUSICOnly the 2 common tuples2
C. MUSIC - DANCE5−25 - 23
A. DANCE U MUSIC4+5−24 + 5 - 27
D. DANCE X MUSIC4×54 \times 520

Increasing order: 2<3<7<202 < 3 < 7 < 20, that is B, C, A, D.

Union removes duplicates, so its cardinality is ∣D∣+∣M∣−∣D∩M∣\lvert D \rvert + \lvert M \rvert - \lvert D \cap M \rvert, while the Cartesian product multiplies the cardinalities.

Keyboard Shortcuts

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