Skip to content
Official PYQ · 2024

GATE CS 2024 Set 1 Q25 — Relational Model: Relational Algebra

Explain with AI
Consider the following two relations, R(A,B)R(A, B) and S(A,C)S(A, C):
RAB10202030304030505095SAC109030454080\begin{array}{|c|} \hline \textbf{R} \\ \hline \begin{array}{c|c} \textbf{A} & \textbf{B} \\ \hline \text{10} & \text{20} \\ \hline \text{20} & \text{30} \\ \hline \text{30} & \text{40} \\ \hline \text{30} & \text{50} \\ \hline \text{50} & \text{95} \end{array} \\ \hline \end{array} \quad \begin{array}{|c|} \hline \textbf{S} \\ \hline \begin{array}{c|c} \textbf{A} & \textbf{C} \\ \hline \text{10} & \text{90} \\ \hline \text{30} & \text{45} \\ \hline \text{40} & \text{80} \\ \end{array} \\ \hline \end{array}
The total number of tuples obtained by evaluating the following expression

σB<C(R⋈R.A=S.AS)\sigma_{B<C}\left(R \bowtie_{R . A=S . A} S\right) is ___________.
View worked solution

Answer: 2

To find the total number of tuples in the expression σB<C(R⋈R.A=S.AS)\sigma_{B < C}\left(R \bowtie_{R.A=S.A} S\right), we evaluate it in two steps:

Step 1: Perform the Join (R⋈R.A=S.ASR \bowtie_{R.A=S.A} S)

We match tuples from RR and SS where the attribute AA is equal:

  • For A=10A = 10:
    • RR has (10,20)(10, 20) and SS has (10,90)  ⟹  (10, 90) \implies (10,20,90)(10, 20, 90)
  • For A=30A = 30:
    • RR has (30,40)(30, 40) and SS has (30,45)  ⟹  (30, 45) \implies (30,40,45)(30, 40, 45)
    • RR has (30,50)(30, 50) and SS has (30,45)  ⟹  (30, 45) \implies (30,50,45)(30, 50, 45)

No other values of AA (i.e., 20,40,5020, 40, 50) have matching tuples in both relations.

Step 2: Apply the Selection (σB<C\sigma_{B < C})

Now, we filter the joined tuples using the condition B<CB < C:

  1. For (10,20,90)(10, 20, 90): 20<9020 < 90 is True (Selected)
  2. For (30,40,45)(30, 40, 45): 40<4540 < 45 is True (Selected)
  3. For (30,50,45)(30, 50, 45): 50<4550 < 45 is False (Not selected)

Thus, the final relation contains exactly 2 tuples.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Relational Model: Relational Algebra questions