Contents Index Joining tables using natural joins Selecting Aggregate Data

ASA Getting Started
  Selecting Data from Multiple Tables

Joining tables using outer joins


In the previous examples, you created joins that returned rows only if they satisfied the join conditions. These joins are called inner joins, and are the default. Sometimes, you may wish to preserve all the rows in one table. To do this, you use an outer join.

You can specify a right outer join, which preserves all the rows in the right table; a left outer join, which preserves the left table; or a full outer join, which preserves all the rows in both tables.

List all customers, and the dates of any orders they have placed

The statement includes all customers, whether or not they have placed an order. If a particular customer has placed no orders, each column in the result that corresponds to order information contains NULL.

For more information, see Outer joins.


Contents Index Joining tables using natural joins Selecting Aggregate Data