• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

self join & inner join

 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
pls,can anybody tell me what is the difference bet ween self join and inner join.

Thanks,
vardhan.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Self join is simply a FK in a table referencing itself. Meaning I have a table that has a PK, and it has a FK field which points to the PK. Thinks like Employees is a good example. you can have a Manager field in Employee to represent who is that employees manager, But the manager himself is also an Employee with a record in the Employee table, so that sub-ordinate has the Manager's Employee id in its Employee record.

Inner Join is a query term. I have two tables, using an Inner Join I get back results where they join. So if I have a table that has a foreign key into the second table, then I get all the results where there is a record in the one table with a corresponding record in the other table through the foreign key. Which is opposite of the Outer Join Types, where you can still get records from the first table, even if there isn's a corresponding record in the other table. Meaning the one's table FK field is null, that record still can come back in the resultset.

Mark
reply
    Bookmark Topic Watch Topic
  • New Topic