PL/SQL Inner Join

The PL/SQL INNER JOIN return rows when there is at least one match in the tables.

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_brand table

BRAND_ID NAME
1 Samsung
2 Apple
3 Nokia
4 HTC
5 BlackBerry

Inner Join example

 
SELECT p.phone_id, b.name as brand, p.phone_name
FROM phones p, phone_brands b
WHERE p.brand_id=b.brand_id
ORDER BY p.phone_id;

Output

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