PL/SQL Right Join

The PL/SQL RIGHT JOIN return all rows from the right table, although there are no matches in the left table.

Phones table

PHONE_ID PHONE_NAME BRAND_ID
1 Galaxy Note Edge 1
2 N910 Galaxy Note 4 1
3 Galaxy S5 Duos 4G 1
4 iPhone 5S 2
5 iPhone 6 Plus 2
6 930 Lumia 3
7 830 Lumia 3

Phone_orders table

ORDER_ID PHONE_ID
1 3
2 3
3 4
4 6

Right Join example

 
SELECT p.phone_id, p.phone_name, o.order_id
FROM phones p RIGHT JOIN phone_orders o
ON p.phone_id=o.phone_id
ORDER BY p.phone_id, o.order_id;

Output

PHONE_ID PHONE_NAME ORDER_ID
3 Galaxy S5 Duos 4G 1
3 Galaxy S5 Duos 4G 2
4 iPhone 5S 3
6 930 Lumia 4