in Databases edited by
6,831 views
16 votes
16 votes

Consider the following two tables and four queries in SQL.

Book (isbn, bname), Stock(isbn, copies)

Query 1: 

SELECT B.isbn, S.copies FROM Book B INNER JOIN Stock S ON B.isbn=S.isbn;

Query 2:  

SELECT B.isbn, S.copies FROM Book B LEFT OUTER JOIN Stock S ON B.isbn=S.isbn;

Query 3: 

SELECT B.isbn, S,copies FROM Book B RIGHT OUTER JOIN Stock S ON B.isbn=S.isbn

Query 4: 

SELECT B.isbn, S.copies FROM Book B FULL OUTER JOIN Stock S ON B.isbn=S.isbn

Which one of the queries above is certain to have an output that is a superset of the outputs of the other three queries?

  1. Query 1
  2. Query 2
  3. Query 3
  4. Query 4
in Databases edited by
by
513 804 798
6.8k views

1 comment

Yeses Answer Definitely D

Because Left Outer Join Only Display in relation Table As Left side Entities

same Way Right Outer Join Display All in Right Side Entities

full outer Join showed all Left And Right Along With Null Values

Ans D is Super Set Its Basic Theory of Under Standing
0
0

Subscribe to GO Classes for GATE CSE 2022

4 Answers

23 votes
23 votes
 
Best answer
Answer is D.

Since the full-outer join is nothing but a combination of inner-join and the remaining tuples of both the tables that couldn't satisfy the common attributes' equality condition, and merging them with "null" values.
selected by
by
7 14 24

1 comment

But how is it possible that a book is in stock but there's no entry in Book (isbn, bname) relation.

If we assume this condition then query 2,3,4 will produce same number of tuples right?
0
0
33 votes
33 votes

These images are self-explanatory. The answer is D.

 

           

Source: https://www.w3schools.com/sql/sql_join.asp

edited by
by
27 61 153

2 Comments

It is right but answer can be B also because in stock table you will not have the book which is not available ,condition is given like that so i think B and D can be the right options .

1
1
picture speaks a thousand words...
0
0
5 votes
5 votes
The full outer join should be the superset of other 3 queries.

Ans: D
by
2 10 20
2 votes
2 votes
Query 4

Ans D
by
2 4 7
Answer:

Related questions