Inner and Outer Joins in DBMS

There are two kinds of joins, each of which either excludes or includes rows in both tables of the join that do not match.  These are:

Inner Join:  An inner join excludes the rows of either table that don’t have a matching value.

Outer Join:  An outer join includes the rows of either table that don’t have a matching value.

Inner join is used to include only rows of both tables that have matching values.  Unmatched rows are excluded and therefore those rows are not returned.

Outer Join —– Left, Right and Full

An outer join occurs when matching and no matching rows of either or both tables are contained in the join.  There are three kinds of outer joins:

Left outer join:  All matched and unmatched rows of the first table and matched rows of the second table are included in the join.

Right outer join:  Matched rows of the first table and matched and unmatched rows of the second table are included in the join.

Full outer join:  Matched and unmatched rows of both tables are included in the join.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: