MySQL JOINS are used with SELECT statement. It is used to retrieve data from multiple tables. It is performed whenever you need to fetch records from two or more tables.
There are three types of MySQL joins:
MySQL Inner Join (called Simple join)
MySQL Outer Join (called Left join)
MySQL Right Join (called Right join)
MySQL Inner Join (Simple join):
It is used to return all rows from multiple tables where the join condition is satisfied. It is the most common type of join.
Syntax:
SELECT columns
FROM table1
INNER JOIN table2
MySQL Left Outer Join:
The Left Outer join returns all rows from the left hand table specified in the ON condition and only those rows from other table where the join condition is fulfilled.
Syntax:
SELECT columns
FROM table1
LEFT [OUTER] JOIN table2
MySQL Right Outer Join:
The Right Outer Join returns all rows from the right hand table specified in the ON condition and only those rows from the other table where the join condition is fulfilled.
Syntax:
SELECT columns
FROM table1
RIGHT [OUTER] JOIN table2
Comments