LEFT OUTER JOIN
LEFT OUTER JOIN returns all records of the left table even if the join-condition does not find any matching record in the right table.
Remarks
|
•
|
A left outer join (or left join) closely resembles a right outer join, except with the treatment of the tables reversed. |
|
•
|
Every row from the left table appears in the joined table at least once. |
|
•
|
If no matching row from the right table exists, NULL appears in columns from the right table for those records that have no match in the left table. |
|
•
|
A left outer join returns all the values from the left table and matched values from the right table (NULL in case of no matching join predicate). |
|
•
|
The query engine hashes the lesser side and streams the greater side over it. |
Syntax
SELECT columns
FROM tableA
LEFT OUTER JOIN tableB
ON tableA.columnX = tableB.columnX
Example
SELECT *
FROM /shared/examples/ds_orders/products products
LEFT OUTER JOIN /shared/examples/ds_orders/orderdetails orderdetails
ON products.ProductID = orderdetails.ProductID