63.7k views
20 votes
7. Which SELECT statement implements a self join?

SELECT item.part_id, type.product_id
FROM part item JOIN product type
ON item.part_id =! type.product_id;
SELECT item.part_id, type.product_id
FROM part item JOIN product type
ON item.part_id = type.product_id;
SELECT item.part_id, type.product_id
FROM part item JOIN part type
ON item.part_id = type.product_id;
SELECT item.part_id, type.product_id
FROM part item JOIN product type
ON item.part_id = type.product_id (+);​

User Jkrnak
by
9.2k points

1 Answer

9 votes

Answer:

SELECT item.part_id, type.product_id

FROM part item JOIN part type

ON item.part_id = type.product_id;

Step-by-step explanation:

A self join is when a table joins to itself, in the above answer the part joins itself, note in bold below

FROM part item JOIN part type

User Ranjana Dangol
by
8.6k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.