Consider the following two relations, R(A, B) and S(A, C):
R:
A | B
---+----
10 | 20
20 | 30
30 | 40
40 | 30
50 | 95
S:
A | C
---+----
10 | 20
20 | 10
30 | 45
40 | 80
The total number of tuples obtained by evaluating the following expression:
sigma_{B > A}(R >< S)
is ___
A. 1
B. 2
C. 3
D. 4
GATE 2024 · Databases · Relational Algebra · medium
Answer: 3 tuples are returned by the expression sigma_{B > A}(R >< S). Answer: C.
Compute natural join R >< S: Match each R tuple with the S tuple having the same A:
R(10,20) + S(10,20) => (10, 20, 20)
R(20,30) + S(20,10) => (20, 30, 10)
R(30,40) + S(30,45) => (30, 40, 45)
R(40,30) + S(40,80) => (40, 30, 80)
R(50,95): A=50 not in S => excluded.
Join result: 4 tuples.