MySQL Joins Example

MySQL joins: There are several tables stored in a database but sometimes need arises that we want to access
data of more than one table in that case MySQL join is used . MySQL joins basically merge two or
more than two tables together to form a single table that contains data of all tables . there
are four types of join in MySQL, these are:

joins

Note :Here Person is Left Table and Orders is Right Table

Inner join

if there is any common key(primary and foreign key) in both tables then the
join so performed is called inner join.

Query

Output
innerjoin

Left join

left join returns all rows from left table even if there is no match in the right table.

Query

Output
leftjoin

Right join

right join returns all rows from right table even if there is no match in the left table

Query

Output
rightjoin

Outer join(Full Join)

outer join displays all rows from left table and right table. if there are rows in
left table which does not matches with the rows in right table , those rows will also
be displayed and viceversa.

Query

Output
outerjoin

joins more than two tables