Joining more than two tables
Joins are not limited to two tables. You can join more than two tables in a single SQL statement.
Inner joins
An inner join is a method of combining two tables that discards rows of either table that do not match any row of the other table. The matching is based on the join condition.
Outer joins
An outer join is a method of combining two or more tables so that the result includes unmatched rows of one of the tables, or of both tables. The matching is based on the join condition.
Full outer join
An full outer join is a method of combining tables so that the result includes unmatched rows of both tables.
Left outer join
A left outer join is a method of combining tables. The result includes unmatched rows from only the table that is specified before the LEFT OUTER JOIN clause.
Right outer join
A right outer join is a method of combining tables. The result includes unmatched rows from only the table that is specified after the RIGHT OUTER JOIN clause.
SQL rules for statements that contain join operations
Typically, DB2 performs a join operation first, before it evaluates the other clauses of the SELECT statement.
Sample data for joins
You can use the sample PARTS table and the PRODUCTS table to practice various types of joins.