A Reference On Joins
When writing SQL, a situation might occur where you have to combine the rows of multiple columns to execute your query. The JOIN clause is used in this case to join two or more tables based on a mutual column.
In order to join two tables, there must be a column in table1 which is also present in table2. Often this will be a primary key column on table1 that is found as a foreign key column on table2, or vice versa.
There are four types of joins:
- INNER JOIN
- RIGHT OUTER JOIN
- LEFT OUTER JOIN
- FULL OUTER JOIN
INNER JOIN
The INNER JOIN clause is used when we need the records which have the same value of the mutual column in both the tables.

RIGHT OUTER JOIN
RIGHT OUTER JOIN is used when we wish to have all records from the "right" table, and just the records which have the same value of the mutual column from the left table.

LEFT OUTER JOIN
LEFT OUTER JOIN is used when we wish to have all records from the left table, and just the records which have the same value of the mutual column from the right table.

FULL OUTER JOIN
FULL OUTER JOIN is used when we wish to have all records from both the tables, whether the records have the same value of the mutual column or not.



