SQL INNER JOINS return all rows from multiple tables where the join condition is met.
We have a table called suppliers with two fields (supplier_id and supplier_name). It contains the following data:
supplier_id supplier_name
10000 rajesh
10001 chotu
10002 ramesh
10003 suresh
We have another table called orders with three fields (order_id, supplier_id, and order_date). It contains the following data:
order_id supplier_id order_date
500125 10000 2003/05/12
500126 10001 2003/05/13
500127 10004 2003/05/14
If we run the SQL statement (that contains an INNER JOIN) below:
SELECT suppliers.supplier_id, suppliers.supplier_name, orders.order_date
FROM suppliers
INNER JOIN orders
ON suppliers.supplier_id = orders.supplier_id;
Our result set would look like this:
supplier_id name order_date
10000 IBM 2003/05/12
10001 Hewlett Packard 2003/05/13