|Lesson 6||LEFT, RIGHT, and FULL joins |
|Objective||Describewhat LEFT, RIGHT, and FULL joins are |
LEFT, RIGHT, FULL joins (Operations)
LEFT and RIGHT are two types of OUTER joins. Remember, an OUTER join is one that returns all of the rows for one
or both of the tables, regardless of whether the data matches.
A LEFT OUTER join is one in which all of the rows will be returned for the table listed on the left side of the join equation. A RIGHT OUTER join returns all of the rows for the table on the right side of the equation.
LEFT and RIGHT joins enter the picture in cases where you want to list all entries from a given table and any entries in the second table if they exist.
FULL OUTER join
A FULL OUTER join is a join in which
all of the rows are returned from both tables, regardless of whether or not a match was found.
FULL (a.k.a. FULL OUTER) joins should be used if you want to return all rows in both tables, listing matches where they occur or
blank column values where information doesn't match This will result in one row for each matched data item in both tables, one row for each
unmatched item from the first table, and one row for each unmatched item from the second table.
In the next lesson, we will look at an example.