What are the different types of joins? Please explain how they differ and why certain types are better in certain situations.
Implicit and explicit
The “explicit join notation” uses the JOIN keyword. The “implicit join notation” simply lists the tables for joining, in the FROM clause of the SELECT statement.
Example of an explicit cross join:
SELECT * FROM employee CROSS JOIN department;
Example of an implicit cross join:
SELECT * FROM employee, department;
INNER JOIN: Returns all rows when there is matching values in BOTH tables.
OUTER JOIN: An outer join) does not require each record in the two joined tables to have a matching record.
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. If no matching record was found then the corresponding result fields will have a NULL value.