RIGHT [OUTER] JOIN

Restriction: This topic applies to Windows environments only.

Right outer joins (the keyword OUTER is optional) include nonmatching rows only from the table named after the RIGHT [OUTER] JOIN clause. Missing values in a row are filled with nulls. The following sample query creates a right outer join between the PART and PARTSUPP tables:

SELECT part.pno, pname, qty
  FROM part RIGHT OUTER JOIN partsupp
  ON part.pno = partsupp.pno

The results of this query contains all matched rows, plus nonmatched rows from the PARTSUPP table (or, the table on the right hand side of the RIGHT OUTER JOIN clause). For example, if the PARTSUPP table contained a nonmatching record for a PNO column value of P9, this information would be part of the result. If, however, the PART table also contained an nonmatched record, this record information would not appear in the result rows. Using the RIGHT [OUTER] JOIN syntax includes nonmatched rows from only the joined table on the right of the RIGHT OUTER JOIN clause.