MySQL and JOINs

There is a great write up about the differences between JOINs in MySQL here:

http://www.wellho.net/mouth/158_MySQL-LEFT-JOIN-and-RIGHT-JOIN-INNER-JOIN-and-OUTER-JOIN.html

Basically, a JOIN only returns records that match.

A LEFT JOIN will returns all rows that match and IN ADDITION all rows in the left table that do not match as well.

A RIGHT JOIN is similar to left except all rows from the RIGHT table are returned.

INNER JOIN returns all rows in both tables.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s