Consider 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:
select student from enrolled where student in (select student from paid)
select student from paid where student in (select student from enrolled)
select E.student from enrolled E, paid P where E.student = P.student
select student from paid where exists
(select * from enrolled where enrolled.student = paid.student)
Which one of the following statements is correct?
- All queries return identical row sets for any database
- Query2 and Query4 return identical row sets for all databases but there exist databases for which Query1 and Query2 return different row sets
- There exist databases for which Query3 returns strictly fewer rows than Query2
- There exist databases for which Query4 will encounter an integrity violation at runtime