Consider the given table called Persons Perform NATURAL JOIN operation on both…

Consider the given table called Persons

Perform NATURAL JOIN operation on both ‘Persons’ and ‘Orders’ tables and what is the number of tuples in the result?

Answer: 4Explanation: A NATURAL JOIN combines rows from the two tables by matching values in all columns that have the same name in both tables. Here the common column…

Attempted by 9 students.

Show answer & explanation

Correct answer: 4

Explanation: A NATURAL JOIN combines rows from the two tables by matching values in all columns that have the same name in both tables. Here the common column is P_Id.

  • Look at the P_Id values in Orders: 30, 30, 10, 10, 50.

  • Look at the P_Id values in Persons: 10, 20, 30.

  • Keep only rows where P_Id appears in both tables: the matching P_Id values are 30 and 10. Orders with P_Id 50 are dropped because there is no corresponding person.

  • For P_Id = 30 there are two orders, so joining with the single Person row for P_Id = 30 produces two result rows. For P_Id = 10 there are two orders, so joining with the single Person row for P_Id = 10 produces two result rows.

Final result: Total number of tuples after the natural join = 4.

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…