February 18th, 2009

OUTER JOIN

Posted by admin in L. JOINs

You have learned that an inner join only happens when there are identical matching values between tables. An INNER JOIN eliminates the rows that are in only one table but have no matching values in the other table.

An OUTER JOIN returns all rows from one of the tables, provided they meet the WHERE or HAVING conditions. The order in which you specify the tables is important in an OUTER JOIN, so you specify the left table or the right table.

 LEFT OUTER JOIN: includes all rows from the left table and all matching rows from the right table. Any left table rows without matching right table rows will have nulls returned for the missing selected values.

RIGHT OUTER JOIN: includes all rows from the right table and all matching rows from the left table. Any left table rows without matching right table rows will have nulls returned for the missing selected values.

FULL OUTER JOIN: includes all rows from the left and right tables. Any table rows not matching the other table rows will have nulls returned for the missing selected values.

Leave a reply

:mrgreen: :neutral: :twisted: :shock: :smile: :???: :cool: :evil: :grin: :oops: :razz: :roll: :wink: :cry: :eek: :lol: :mad: :sad: