Database Tutorial

Course Tutorial Site

Site Admin

Self joins

without comments

Two Table Self Join

A two table self join uses two copies of a single table. The join can use an INNER, LEFT, RIGHT, or FULL JOIN.

A table supports a two table self join when it contains a primary key and a foreign key column. You use the relationship between the primary key and foreign key columns to map the relationship between the two copies of the same table.

While this particular table would support a three table self join, it also supports two possible two table self joins. You join the two tables by mapping the created_by column to the system_user_id primary key, or by mapping the last_updated_by foreign key column to the system_user_id primary key.

Written by michaelmclaughlin

August 13th, 2018 at 1:26 pm

Posted in