Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose relations R(A, B) and S(B, C, D) are as follows: Compute the full outer

ID: 3863985 • Letter: S

Question

Suppose relations R(A, B) and S(B, C, D) are as follows: Compute the full outer join on B, the left outer join on, and the right outer join on B. In each case, R is the left operand and S is the right operand. Then, answer the following questions for each of the three results: How many rows are there in the result? How many NULL's appear in the result? Finally, find the correct statement in the list below. The right outer join has 2 NULL's. The left outer join has 2 row. The full outer join has 3 NL LL's. The right outer join has no NULL's.

Explanation / Answer

For an outer join, the result also includes all rows from the first operand ("left outer join"), or the second operand ("right outer join"), or both ("full outer join").

FULL OUTER JOIN

The FULL OUTER JOIN keyword returns all rows from the left table (table1) and from the right table (table2).

SELECT * FROM R FULL OUTER JOIN S ON R.B=S.B

OUTPUT

a) 4

b) 5

--------------------------------------------------------------------------------------------------------------------------

LEFT OUTER JOIN

The LEFT JOIN keyword returns all rows from the left table (table1), with the matching rows in the right table (table2). The result is NULL in the right side when there is no match.

SELECT * FROM R LEFT OUTER JOIN S ON R.B=S.B

OUTPUT

a)3

b)3

---------------------------------------------------------------------------------------------------------------------------

RIGHT OUTER JOIN

The RIGHT JOIN keyword returns all rows from the right table (table2), with the matching rows in the left table (table1). The result is NULL in the left side when there is no match.

SELECT * FROM R RIGHT OUTER JOIN S ON R.B=S.B

OUTPUT

a)3

b)2

------------------------------------------------------------------------------------------------------------------------------------

FINALLY FROM THE OPTIONS GIVEN BELOW WE CAN SEE THAT OPTION a IS CORRECT THAT IS RIGHT OUTER JOIN HAS 2 NULL'S

A B B C D 1 2 NULL NULL NULL 3 4 4 5 1 5 6 6 7 2 NULL NULL 8 9 3
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote