This is a practice question for a relational algebra question which I don't understand.
Consider two relations $R(A, B)$ and $S(B,C)$. Which of the following relational algebra expressions is not equivalent to the others?
- $\pi_{R.A, R.B} (R \Join S)$
- $R \Join \pi_{S.B}(S)$
- $R \cap (\pi_{A} (R) \times \pi_B (S))$
- None, they are all equivalent.
I think 1 yeilds: $X_1(C)$
I think 2 yields $\emptyset$.
I am unsure about 3.
But the answer is that they are all equivalent!
They are indeed all equivalent.
For the first:
And the second:
And the third:
So all three are equal to $\{ (a,b) \in A \times B \mid (a,b) \in R \land \exists c \in C : (b,c) \in S \}$.