Wednesday, July 30, 2014

I went to lunch with some of the guys from work yesterday and SQL joins came up in conversation.

  • This touches on Left and Right joins. A Left join will return all results in the first table (the table selected from) and may or may not return matches in the second table (the table joined) if they are there. The column values for the second table will just be empty if they cannot be brought back due to a lack of a dance partner. When people talk of Outer joins or Outer Left joins they just mean Left joins.
  • Apparently there is also a concept of a Right join which will bring back everything in the second table but only what rows it can for the first table.
  • An Inner join will bring back only rows wherein both tables have records.
  • This touches on Cross joins and these seem to take two different record sets and make records for every possible combination of a record from one set with a record from the other set. This is also called a Cartesian join. You get the same data back that you'd have in a matrix in a more sequential shape.

Addendum 8/24/2014: An ambiguous join wherein only the world join is specified in MSSQL does an inner join as it turn out and as further kicked around here. Perhaps my belief that "join" in a generic sense means "left join" is erroneous or of my out of date experience with MySQL.

No comments:

Post a Comment