Relational schema Sql question,why a is correct?


#1

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:

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) Query2 and Query4 return identical row sets for all databases but there exist databases for which Query1 and Query2 return different row sets.

c) There exist databases for which Query3 returns strictly fewer rows than Query2

d) There exist databases for which Query4 will encounter an integrity violation at runtime.


#2

i cant dare to read these q uestions in exams so verbal but gate always ask like this,help please


#3

I think option a is correct.
since student course is primary key then it may happen same student enrolled for more than one course.
like
Nisha networks
Nisha architecture
Nisha programming101

so in other table there will be only one row which by common sense should be the sum of all courses amount,so
query 1 will return 3 rows.
I think iam right.Any challengers?