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