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

Consider the following three SQL queries (Assume the data in the people table) :

Consider the following three SQL queries (Assume the data in the people table) : (1) Select Name from people where Age > 21; (2) Select Name from people where Height > 180; (3) Select Name from people where (age > 21) or (Height > 180); If the SQL queries (1) and (2) above, return 10 row and 7 rows in the result set respectively, then what is one possible number of rows returned by the SQL query (3)?
  1. A3
  2. B7
  3. C10
  4. D21
Show answerHide answer

Correct answer: (C) 10

Explanation

Query (3) returns the union of the two result sets, so it returns between 10 and 17 rows. If all rows are distinct the answer would be 10 + 7 = 17; if set (2) is a subset of set (1), it is 10 + 7 – 7 = 10. Among the options only 10 is possible.

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

This is question 35 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.