SQL Joins Simple Notes


INNER JOIN
Inner join only returns a result that will contain matching records from both tables.

OUTER JOIN
An outer join is the inverse of the inner join. It only returns those records not in both tables.

LEFT JOIN
A left join returns all the records in the “left” table whether they have a match in the right table or not.

If, however, they do have a match in the right table – give me the “matching” data from the right table as well. If not – fill in the holes with null.

RIGHT JOIN
A right join returns all the records in the “right” table whether they have a match in the left table or not.

If, however, they do have a match in the left table – give me the “matching” data from the left table as well. If not – fill in the holes with null.

FULL JOIN
Result will contain all records from both tables, and fill in NULLs for missing matches on either side

LEFT OUTER JOIN
A left outer join combines the ideas behind a left join and an outer join. Basically – if you use a left outer join you will get the records in the left table that DO NOT have a match in the right table.

RIGHT OUTER JOIN
A right outer join combines the ideas behind a right join and an outer join. Basically – if you use a right outer join you will get the records in the right table that DO NOT have a match in the left table.

I got this info from the net

Visual Explanation of Joins
‘Getting’ JOINS
Using MySQL JOINS
SQL JOIN
W3C Schools.com

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

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

%d bloggers like this: