Question 34Asked in UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)

Suppose ORACLE relation R(A, B) currently has tuples {(1, 2), (1, 3), (3, 4)} and relation S(B, C) currently has {(2, 5), (4, 6), (7, 8)}. Consider the…

Suppose ORACLE relation R(A, B) currently has tuples {(1, 2), (1, 3), (3, 4)} and relation S(B, C) currently has {(2, 5), (4, 6), (7, 8)}. Consider the following two SQL queries SQ1 and SQ2 : SQ1 : Select * From R Full Join S On R.B = S.B; SQ2 : Select * From R Inner Join S On R.B = S.B; The numbers of tuples in the result of the SQL query SQ1 and the SQL query SQ2 are given by :
  1. A2 and 6 respectively
  2. B6 and 2 respectively
  3. C2 and 4 respectively
  4. D4 and 2 respectively
Show answerHide answer

Correct answer: (D) 4 and 2 respectively

Explanation

R.B = S.B holds for 2 records (B = 2 and B = 4), so SQ2 (inner join) returns 2 tuples. The full outer join returns the 2 matching tuples plus the unmatched tuple of R (1, 3) and the unmatched tuple of S (7, 8), so SQ1 returns 4 tuples.

From UGC NET Computer Science PYQ, December 2015 (Paper II & III, Selected Questions)

This is question 34 of UGC NET Computer Science PYQ, December 2015 (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.