A Visual Explanation of SQL Joins

Posted: April 6, 2011 in Database, Programming
Tags: , ,

If there’s one thing about databases that I’ve always struggled to get my head around, it’s complex joins. The syntax and arrangement of tables for inner/outer joins have done my head in for so long until I found this article by Jeff AtwoodA Visual Explanation of SQL Joins.

Although, he does respond to comments on his article with regards to accuracy:

“The commenters pointing out that the diagrams break down in case of multiple and or duplicate results, are absolutely right. I was actually thinking of joins along the primary key, which tends to be unique by definition, although the examples are not expressed that way.

Like the cartesian or cross product, anything that results in more rows than you originally started with does absolutely breaks the whole venn diagram concept. So keep that in mind.”

It uses an easy to understand graphical method of explaining what parts of a table are found when using the various types of joins and, once and for all, I think I may have finally properly learned each join.

Advertisement

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 )

Connecting to %s