A join creates a 'virtual' table from 2 tables.
It does this by combining the rows from one table with the rows from another table.
For a join to work as expected, there needs to be a 1-1 relationship between the rows.
Example:
Customer, Order
Each order has a customer
SELECT order.id, customer.name
FROM order, customer
WHERE order.id=123
AND order.customerid=customer.id
In effect, this says:
Find order id 123
find its associated customer id
find the name of the customer with that ID
the select criteria
order.customerid=customer.id
is what creates the binding of these 2 tables.
(Another way of doing EXACTLY the same thing:
SELECT order.id, customer.name
FROM order
INNER JOIN customer
ON order.id=customer.id
WHERE order.id=123 )
You can keep adding tables to the join
SELECT order.id, customer.name, ordertype.name
FROM order, customer, ordertype
WHERE order.id=123
AND order.customerid=customer.id
AND order.typeid = ordertype.id
(Another way of doing EXACTLY the same thing:
SELECT order.id, customer.name, ordertype.name
FROM order
INNER JOIN customer
ON order.id=customer.id
INNER JOIN ordertype
ON order.typeid=ordertype.id
WHERE order.id=123 )
etc.