Joins Introduction

Posted on January 2, 2009, under MySQL.

Hello All,

Welcome to this MySQL Join tutorial. Joins sometimes seems to very difficult for the newbie. Earlier, when I started it was a nightmare for me and i was sounding difficult on this and later as you work with this, it becomes so simple. Ok lets get into the topic:

What is Joins?

Joins is a keyword in MySQL which is used to join one or more tables (atleast 2 tables) to retrieve the records based on the conditions like how you used to write a simple where condition.

Types of Joins?

There are different types of Joins in MySQL:

Join/Inner Join: Return rows when there is at least one match in both tables i.e where the condition matches on both the tables:

Self Join: It is joining a table to itself.

Left Join: Return all rows from the left table, even if there are no matches in the right table.

Right Join: Return all rows from the right table, even if there are no matches in the left table.

Outer Join: It does not require each record in the two joined tables to have a matching record. The joined table retains each record, even if no other matching record exists.

There are two types of Outer Join: Left Outer Join (Left Join) and Right Outer Join (Right Join)

Now lets see each types of Joins with a illustrated example.

Leave a Comment

You must be logged in to post a comment.