Get to know the data
JOIN revisited
LEFT JOIN
RIGHT JOIN
FULL JOIN
OUTER JOINS
Aliases for tables
21. Summary

Instruction

Absolutely amazing! Wonderful job!

As you can see, self joins can be quite convenient.

That's all for now. But before you proceed to Part 6, let's take a look at what learned:

  • INNER JOINs (or simply JOINs) show only the rows that are connected with an ON clause.
  • LEFT OUTER JOINs (or simply LEFT JOINs) show all rows from the left table and all matching rows from the right table. If the right table has no matching rows, the corresponding value for the right table's column will be NULL.
  • RIGHT OUTER JOINs (or simply RIGHT JOINs) show all rows from the right table and all matching rows from the left table. If the left table has no matching rows, the corresponding value for the left table's column will be NULL.
  • FULL OUTER JOINs (or simply FULL JOINs) is a union of LEFT JOIN and RIGHT JOIN. All the unconnected rows get assigned a value of NULL.
  • FROM Table1 LEFT JOIN Table2 is the same as FROM Table2 RIGHT JOIN Table2,
  • Tables can be given aliases. The syntax looks like this: <table> AS <alias>. From the moment you give an alias to the table, you have to use the alias instead of the table name.

Exercise

Click Next exercise to finish this part.