GATE CS 2012 · ER-Model

MCQ · 2 marks · Problem DBMS-RELM-0081

Consider the following relations A, B and C:\[\begin{array}{ccc} \textbf{A} & \textbf{B} & \textbf{C} \\ \begin{array}{|c|c|c|} \hline \text{Id} & \text{Name} & \text{Age} \\ \hline 12 & \text{Arun} & 60 \\ 15 & \text{Shreya} & 24 \\ 99 & \text{Rohit} & 11 \\ \hline \end{array} & \begin{array}{|c|c|c|} \hline \text{Id} & \text{Name} & \text{Age} \\ \hline 15 & \text{Shreya} & 24 \\ 25 & \text{Hari} & 40 \\ 98 & \text{Rohit} & 20 \\ 99 & \text{Rohit} & 11 \\ \hline \end{array} & \begin{array}{|c|c|c|} \hline \text{Id} & \text{Phone} & \text{Area} \\ \hline 10 & 2200 & 02 \\ 99 & 2100 & 01 \\ \hline \end{array} \end{array}\]How many tuples does the result of the following relational algebra expression contain? Assume that the schema of A\(\cup\)B is the same as that of A.\[(A\cup B)\bowtie _{A.Id \gt 40 \vee C.Id \lt 15}C\]
  1. A
    7
  2. B
    4
  3. C
    5
  4. D
    9

Solve it on GATE DA practice →More Relational Model & SQL problems

Show the worked solution\(A\cup B\) removes the repeated tuples (15, Shreya, 24) and (99, Rohit, 11), leaving 5 tuples with Ids 12, 15, 99, 25, 98.The theta join pairs each of these with each tuple of C and keeps a pair when \(A.Id>40\) or \(C.Id<15\).C tuple with Id 10: \(C.Id<15\) holds, so all 5 tuples of \(A\cup B\) qualify: 5 tuples.C tuple with Id 99: \(C.Id<15\) fails, so \(A.Id>40\) is needed: Ids 99 and 98 qualify: 2 tuples.\[5+2=7.\]Answer: A

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com