2. Why use full join?
Glad you asked.
The Full Join function combines records
from two tables into one display,
automatically inserting “null” values for
missing matches on either side
Full Join can be used to combine all
columns from two tables into one
comprehensive table, OR you can choose
specific columns from each table to
combine information
3. How do you Full Join?
First, you select the column from the table you would like to join with
another TABLE (use the * function if you want all of the columns to display)
Once you do a SELECT statement clarifying this, you FULL JOIN with the
target table
Then, you select which common column, or field, you would like to initiate
the full join with. Ta-Da! Your full join is complete.
Let’s look at some examples!
5. This join is
between the
tables “books”
and “borrowers”
using the
common column
“book_id”
6. Joined Table Display
In this example, using the common column “book_id”, we
created a FULL JOIN between books and borrower tables.
All the columns in both tables now display together.
7. This join is between
“patrons” and
“borrowers”
using the common
column “patron_id”
9. NULL Values
Where there is no overlapping information, a NULL will
appear in the row; thus, you can easily identify where
there is nothing populated in a field
10. When is using Full Joins
appropriate?
Examples using our in class library:
● To see if a title has circulated recently
● To see what patrons have borrowed
● To see if any items have not been returned
The possibilities are endless...
11. Other Ways to use FULL JOIN
● In some situations you might want to merge information
contained in one table with information in another table.
This would display the same information, but differently.
● For instance, to display the descriptive information for an ID
in a junction table, you can create a FULL JOIN between the
column containing the text value of an ID in a table that
otherwise wouldn’t contain it.
This is hard to explain with words. Lets
look at the next slide and revisit this
information on the other end.
12.
13. So….
● If you want to see the titles of books in
the borrower table, rather than the book
ID, you can do a FULL JOIN to display this
information.
● This would work for any field where an
ID is displayed. You can basically use the
FULL JOIN to connect any information
contained in one column in one table, to
information contained in a separate
table.
● To summarize, a FULL JOIN combines all
of the effects of applying left and right
joins