Mike Online
  • Home
  • Vids & Photos
  • Guitar
    • Recordings >
      • My recordings
      • The CassTrators (MySpace)
    • Song chords >
      • Maggie May
      • Bob Dylan
      • Stars
      • Sunhee
    • Guitar tuner
  • Computing
    • QlikView
    • VBA & Excel
    • Visual Basic
    • SQL Server
    • Password Cracker >
      • ExcelFileHacker
  • Downloads
  • More...
    • Sidney Barrett
    • Wine >
      • Mr CCJ Berry - Blackberry Wine
      • Victory Blackberry Wine
      • Results
      • Links
    • Pottery >
      • Guides
      • Our Pottery >
        • Sunny's work...
        • Glaze - before & after
      • Links
    • Me... live
    • Jukebox
    • Education >
      • ESL
      • Academic writing
      • Korean
    • Calligraphy
    • TimesTables
    • App Dev
    • Links
    • Contact me

SQL Server Joins - cheat sheet

With thanks to SQL Authority


There are 3 main types of join in SQL Server:


1 - Inner Join
2 - Outer Join
(3 sub types)
       i   - left outer join (same as 'left join')
       ii  - right outer join (same as 'right join')
       iii - full outer join
3 - Cross Join



Breakdown of join types:

1 - Inner Join

This join returns rows when there is at least one match in both the tables
Picture

2(i) - Left Outer Join

This join returns all the rows from the left table in conjunction with the matching rows from the right table. If there are no columns matching in the right table, it returns NULL values.
Picture

2(ii) - Right Outer Join

This join returns all the rows from the right table in conjunction with the matching rows from the left table. If there are no columns matching in the left table, it returns NULL values.


Picture

2(iii) - Full Outer Join

This join combines left outer join and right outer join. It returns row from either table when the conditions are met and returns null value when there is no match.


Picture

3 - Cross Join

This join is a Cartesian join that does not necessitate any condition to join. The resultset contains records that are multiplication of record number from both the tables.

Picture
Powered by Create your own unique website with customizable templates.