SQL joins are used to combine two or more tables, based on a common field between them. The most common type of join is:
• INNER JOIN: Returns all rows when there is at least one match in BOTH tables
• LEFT JOIN: Return all rows from the left table, and the matched rows from the right table
• RIGHT JOIN: Return all rows from the right table, and the matched rows from the left table
• FULL JOIN: Return all rows when there is a match in ONE of the tables
Select order.oid, person.name, order.orderdate from order inner join person on order.oid = person.id
Select person.name, order.oid from person left join order on person.id = order.oid order by person.name
Select order.oid, person.name from order right join person on order.oid = person.id order by order.oid
Select person.name, order.oid from person full outer join order on person.id = order.oid order by person.name