Types of JOINs:
Returns records that have matching values in both tables.

SELECT columns
FROM table1
INNER JOIN table2
ON table1.column = table2.column;
SELECT orders.order_id, customers.customer_name
FROM orders
INNER JOIN customers
ON orders.customer_id = customers.customer_id;
Returns all records from the left table (table1), and the matched records from the right table (table2). If no match is found, NULLs are returned for columns from the right table.

SELECT columns
FROM table1
LEFT JOIN table2
ON table1.column = table2.column;
SELECT orders.order_id, customers.customer_name
FROM orders
LEFT JOIN customers
ON orders.customer_id = customers.customer_id;
Returns all records from the right table (table2), and the matched records from the left table (table1). If no match is found, NULLs are returned for columns from the left table.
SELECT columns
FROM table1
RIGHT JOIN table2
ON table1.column = table2.column;
SELECT orders.order_id, customers.customer_name
FROM orders
RIGHT JOIN customers
ON orders.customer_id = customers.customer_id;
Returns all records when there is a match in either left (table1) or right (table2) table. If no match is found, NULLs are returned for the columns where there is no match.

SELECT columns
FROM table1
FULL OUTER JOIN table2
ON table1.column = table2.column;
SELECT orders.order_id, customers.customer_name
FROM orders
FULL OUTER JOIN customers
ON orders.customer_id = customers.customer_id;
Returns the Cartesian product of the two tables, i.e., all possible combinations of rows from the two tables.
SELECT columns
FROM table1
CROSS JOIN table2;
SELECT customers.customer_name, products.product_name
FROM customers
CROSS JOIN products;
A self join is a regular join but the table is joined with itself.

SELECT a.column, b.column
FROM table1 a, table1 b
WHERE condition;
SELECT a.employee_name, b.manager_name
FROM employees a, employees b
WHERE a.manager_id = b.employee_id;