• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

self join & inner join

 
Reshma Reddy
Ranch Hand
Posts: 197
  • 0
  • 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.
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic