Question 62Asked in UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)

Consider the relations R(A, B) and S(B, C) and the following four relational algebra queries over R and S:

Consider the relations R(A, B) and S(B, C) and the following four relational algebra queries over R and S: I. π_A,B (R ⋈ S) II. R ⋈ π_B(S) III. R ∩ (π_A(R) × π_B(S)) IV. π_A,R.B (R × S) where R.B refers to the column B in table R. One can determine that:
  1. AI, III and IV are the same query
  2. BII, III and IV are the same query
  3. CI, II and IV are the same query
  4. DI, II and III are the same query
Show answerHide answer

Correct answer: (D) I, II and III are the same query

Explanation

I, II and III all return exactly those tuples of R whose B value appears in S, whereas IV returns every (A, R.B) pair of R as long as S is non-empty. Example: R = {(10, 1), (20, 2)}, S = {(2, 30), (3, 40)}. (I) R ⋈ S = {(20, 2, 30)}, so π_A,B(R ⋈ S) = {(20, 2)}. (II) π_B(S) = {(2), (3)}, so R ⋈ π_B(S) = {(20, 2)}. (III) π_A(R) × π_B(S) = {(10, 2), (10, 3), (20, 2), (20, 3)}, and R ∩ that = {(20, 2)}. (IV) π_A,R.B(R × S) = {(10, 1), (20, 2)}. So I, II and III are the same query.

From UGC NET Computer Science PYQ, June 2016 (Paper II & III, Selected Questions)

This is question 62 of UGC NET Computer Science PYQ, June 2016 (Paper II & III, Selected Questions). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.