6,831 views

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

### 1 comment

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

### Subscribe to GO Classes for GATE CSE 2022

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.
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?

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

by
27 61 153

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 .

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

Ans: D
by
2 10 20
Query 4

Ans D
by
2 4 7