ORACLE | ||||||||
| ||||||||
| ||||||||
| ||||||||
| ||||||||
| ||||||||
| ||||||||
| ||||||||
|
Oracle - Inner Join
Inner Join is the simplest and most common type of join. It is also known as simple join. It returns all rows from multiple tables where the join condition is met.
SELECT columns
FROM table1
INNER JOIN table2
ON table1.column = table2.column;
Let's take an example to perform Inner Join on two tables "Suppliers" and "Orders".
SUPPLIER_ID | SUPPLIER_NAME | SUPPLIER_ADDRESS |
---|---|---|
1 | Reebok shoes | rajiv nagar |
2 | USPA Shirts | Ullas nagar |
3 | Kingfisher | Sriram colony |
ORDER_NUMBER | SUPPLIER_ID | CITY |
---|---|---|
101 | 1 | Hyderabad |
102 | 2 | Mumbai |
This example will return all rows from "suppliers" and "orders" table where there is a matching supplier_id value in both the suppliers and orders tables.
SELECT suppliers.supplier_id, suppliers.supplier_name, orders.order_number
FROM suppliers
INNER JOIN orders
ON suppliers.supplier_id = orders.supplier_id;
SUPPLIER_ID | SUPPLIER_NAME | ORDER_NUMBER |
---|---|---|
1 | Reebok Shoes | 101 |
2 | USPA Shirts | 102 |