Gate CS-2006 Question Paper With Solutions

Q. 37Consider the relation enrolled (student, course) in which (student, course) is the primary key, and the relation paid (student, amount) where student is the primary key. Assume no null values and no foreign keys or integrity constraints.
Given the following four queries:

Query1:

select student from enrolled where student in (select student from paid)

Query2:

select student from paid where student in (select student from enrolled)

Query3:

select E.student from enrolled E, paid P where E.student = P.student

Query4:

select student from paid where exists 
    (select * from enrolled where enrolled.student = paid.student)

Which one of the following statements is correct?

(A) All queries return identical row sets for any database

(B) Query 2 and Query 4 return identical row sets for all databases but there exist database for which Query 1 and Query 2 retrun different row sets

(C) There exist databases for which Query 3 returns strictly fewer rows than Query 2

(D) There exist databases for which Query 4 will encounter an intergrity violation at runtime

Learn More:   Gate ME 2014-1 Question Paper With Solutions

Answer: (B)

Explanation:

Gate CS-2006 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here