• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

self join & inner join

 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • 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: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • 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
 
He baked a muffin that stole my car! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic