Awesome q2a theme
0 votes
1 view

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?

  1. All queries return identical row sets for any database
  2. Query2 and Query4 return identical row sets for all databases but there exist databases for which Query1 and Query2 return different row sets
  3. There exist databases for which Query3 returns strictly fewer rows than Query2
  4. There exist databases for which Query4 will encounter an integrity violation at runtime
in Databases by (3.6k points) | 1 view

Please log in or register to answer this question.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.
Top Users Jul 2020
  1. Shaik Masthan

    39 Points

  2. hiteshpujari

    9 Points

  3. Venkatesh Akhouri

    6 Points

  4. Meghana518

    6 Points

  5. bittujash

    6 Points

  6. Pawan_k

    6 Points

  7. rits78671

    6 Points

  8. srestha

    6 Points

  9. RavGopal

    4 Points

  10. Sumaiyas

    4 Points

7,543 questions
1,783 answers
10,867 comments
90,482 users