SQL RIGHT JOIN
SQL RIGHT JOIN (RIGHT OUTER JOIN) always contains all records of right table (Table B) even of join condition does not find any matching record in left table (Table A).
SQL OUTER JOIN - OUTER JOIN is a join two table involving common attributes from two tables. But tables (Table A) does not require to have a matching value to other table (Table B).
Example Table
Considering following SQL left join example, category
, product
is our example table.
|
|
Example
SQL> SELECT *
FROM product RIGHT OUTER JOIN category
ON product.category_id = category.category_id;
CATEGORY_ID PRODUCT_NAME CATEGORY_ID CATEGORY_NAME
----------- -------------------- ----------- --------------------
1 Nokia 1 Mobiles
1 Samsung 1 Mobiles
2 HP 2 Laptops
2 Dell 2 Laptops
3 Apple 3 Tablet
4 Nikon 4 Cameras
NULL NULL 5 Gaming
7 rows selected.