Database Joins

A database join combines columns from one or more tables into rows of data.

There are 5 types of joins:
  • Inner Join - combines all columns/rows from the specified tables based on the join-predicate (for instance, where table1.val == table2.val). Rows that do not match are not included in the query result.
  • Outer Join - like an Inner Join, but also included all rows from both tables. Data that does not have a matching value in the the other table is set to NULL.
  • Left Join - an Outer Join, but only rows from the first table specified (the "left") one are included.
  • Right Join - an Outer Join, but only rows from the first table specified (the "left") one are included.
  • Cross Join - return every row from the first table combined with every row from the second table.