mysql join
-- MySQL INNER JOINS return all rows from multiple tables where the join condition is met.
SELECT columns
FROM table1
INNER JOIN table2
ON table1.column = table2.column;
-- LEFT OUTER JOIN
-- Another type of join is called a MySQL LEFT OUTER JOIN. This type of join returns all rows from the LEFT-hand table specified in the ON condition and only those rows from the other table where the joined fields are equal (join condition is met).
SELECT columns
FROM table1
LEFT JOIN table2
ON table1.column = table2.column;
-- RIGHT OUTER JOIN
-- Another type of join is called a MySQL RIGHT OUTER JOIN. This type of join returns all rows from the RIGHT-hand table specified in the ON condition and only those rows from the other table where the joined fields are equal (join condition is met).
SELECT columns
FROM table1
RIGHT JOIN table2
ON table1.column = table2.column;
-- The mySQL CROSS JOIN produces a result set which is the number of rows in the first table multiplied by the number of rows in the second table if no WHERE clause is used along with CROSS JOIN. This kind of result is called as Cartesian Product.
-- If WHERE clause is used with CROSS JOIN, it functions like an INNER JOIN.
SELECT columns
FROM table1
CROSS JOIN table2;