Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inner join Vs outer join

 
kri shan
Ranch Hand
Posts: 1460
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between inner join and outer join ?
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- inner joins only returns rows that "match" in both tables
- outer joins return "all" rows from 1st table, and null valued columns in rows that don't exist in the 2nd table

for example, imagine we have this data, also for each query, we join them on column "id":


Also to note, the SQL syntax for outer joins is database vendor specific, Oracle used different notation from say SQL Server.
 
kri shan
Ranch Hand
Posts: 1460
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Oracle outer join is defined as * symbol. in Sybase outer join is defined as + symbol. What is the outer join symbol for DB2 ?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kri,

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic