The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+2 votes

Suppose ORACLE relation R(A,B) currently has tuples {(1,2), (1,3), (3,4)} and relation S(B,C) currently has {(2,5), (4,6), (7,8)}.Consider the following two SQL queries SQ1 and SQ2:

SQ1: Select * From R Full Join S On R.B=S.B; SQ2: Select * From R Inner Join S On R.B=S.B;

The numbers of tuples in the result of the SQL query SQ1 and the SQL query SQ2 are given by:

- 2 and 6 respectively
- 6 and 2 respectively
- 2 and 4 respectively
- 4 and 2 respectively

+4 votes

Best answer

inner join gives the record of two tables based on = condition

here R.B=S.B holds for 2 records when B=2 and B=4 hence its result w hence 2

for SQ2 Full Join or full outer join gives the result of left outer join(all rows of left table whether there is match or not) + right outer join( all rows of right table whether there is match or not with the left) now both table has 3 records but there are 2 match and 2 mismatch

hence SQ1 will give 4 records

so ans is choice D

here R.B=S.B holds for 2 records when B=2 and B=4 hence its result w hence 2

for SQ2 Full Join or full outer join gives the result of left outer join(all rows of left table whether there is match or not) + right outer join( all rows of right table whether there is match or not with the left) now both table has 3 records but there are 2 match and 2 mismatch

hence SQ1 will give 4 records

so ans is choice D

- All categories
- General Aptitude 1.8k
- Engineering Mathematics 7.3k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.1k
- Non GATE 1.6k
- Others 1.8k
- Admissions 595
- Exam Queries 576
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 17

50,362 questions

55,786 answers

192,410 comments

90,918 users