Visualizing Types Of Joins

Kevin Feasel

2018-02-19

Syntax

Daniel Hutmacher has a nice PDF cheat sheet showing different types of joins:

How it works: For each join example, there are two tables, the left and the right table, shown as two columns. For the sake of simplicity, these tables are called “a” and “b” respectively in the code.

You’ll notice that the sheet uses a kind of pseudo-code when it comes to table names and column names.

Click through for the PDF.  I appreciate that he did not use Venn diagrams, as those should be saved for Union/Intersect/Except.

Related Posts

Finding The Last Non-Null Value With Snowflake

Koen Verbeeck shows how two words makes solving a problem with Snowflake a lot easier than with SQL Server: Sometimes you need to find the previous value in a column. Easy enough, the LAG window function makes this a breeze (available since SQL Server 2012). But what if the previous value cannot be null? You […]

Read More

Concerns With DISTINCT

Anvesh Patel does not like DISTINCT: I am telling you personally that I hate the use of DISTINCT.DISTINCT used by those people, who are not sure about their data set or SELECT statement or JOINS.Whenever I get any query with DISTINCT, immediately I suggest to remove it. I agree with this sentiment about 85% of […]

Read More

Categories

February 2018
MTWTFSS
« Jan Mar »
 1234
567891011
12131415161718
19202122232425
262728