File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Oracle/OAS and the fly likes self join & inner join Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "self join & inner join" Watch "self join & inner join" New topic
Author

self join & inner join

Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
Hi all,
pls,can anybody tell me what is the difference bet ween self join and inner join.

Thanks,
vardhan.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: self join & inner join