DB2 Right Outer Join Statement

OUTER JOIN Statement LEFT OUTER JOIN Statement

Advertisements


RIGHT OUTR JOIN will retrieves matched rows from the tables which are provided before RIGHT OUTR JOIN keyword and all rows from the tables provide after the keyword.

Let us say, A and B table are joining. A has the matching row for a specific value in matching columns and B also should have the row with the matching value. Then only the row will appear in result table.

Let us say, A and B table are joining. A has no matching row for a specific value in matching columns. But B has row with the matching value. Still the row is joined in OUTER JOIN, but the columns of A will be filled up with NULL values in result table.


Syntax:

						
SELECT A-columns-list,
       B-columns-list
  FROM table-A RIGHT OUTER JOIN table-B
    ON joining-column(s)
 WHERE condition


In the above case, it will retrieve only matched rows from table-A and all the rows from table-B


OUTER JOIN Statement LEFT OUTER JOIN Statement

Advertisements