DB2 Left Outer Join Statement

RIGHT OUTER JOIN Statement DB2 NULL Statement

Advertisements


LEFT OUTER JOIN will retrieves all the rows from the tables which are provided before LEFT OUTER JOIN keyword and only matched 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 the matching row for a specific value in matching columns. But B has no row with the matching value. Still the row is joined in OUTER JOIN, but the columns of B will be filled up with NULL values in result table.

Syntax:

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

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


If any questions on the above, post your queries on DB2 Discussion forum


RIGHT OUTER JOIN Statement DB2 NULL Statement

Advertisements