Visit me elsewhere:

TSQL

Inner Join

Only rows that match join condition SELECT * FROM Table1 AS t1 INNER JOIN Table2 AS t2 ON t1.key2 = t2.key2 ;

Outer Join

Left Outer Join

Right may be empty SELECT * FROM Table1 AS t1 LEFT OUTER JOIN Table2 AS t2 ON t1.key2 = t2.key2 ;

Right Outer Join

Left may be empty SELECT * FROM Table1 AS t1 RIGHT OUTER JOIN Table2 AS t2 ON t1.key2 = t2.key2 ;

Full Outer Join

Left or right may be empty SELECT * FROM Table1 AS t1 FULL OUTER JOIN Table2 AS t2 ON t1.key2 = t2.key2 ;

Self Join

SELECT DISTINCT t1.key2, t1.key1 FROM Table1 t1 INNER JOIN Table1 t2 ON t1.key2 = t1.key2 AND t1.key1 <> t2.key1 ;

Cross Join

A cross join with a where clause behaves like an inner join. Otherwise: Cartesian product; every row of left combined with every row of right. SELECT * FROM Table1 t1 CROSS JOIN table2 t2 ;