edited by
10,092 views
20 votes
20 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
edited by

5 Answers

Best answer
27 votes
27 votes
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
36 votes
36 votes

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

 

           

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

edited by
Answer:

Related questions

34 votes
34 votes
5 answers
1
27 votes
27 votes
6 answers
3
gatecse asked Feb 14, 2018
11,317 views
The set of all recursively enumerable languages is:closed under complementationclosed under intersectiona subset of the set of all recursive languagesan uncountable set