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

Difference between inner and outer joins

James Adams
Ranch Hand

Joined: Sep 12, 2003
Posts: 188
Can someone explain the difference between inner and outer joins in SQL queries? Is there an online reference?

Can someone suggest a better forum/newsgroup for general SQL questions?

Thanks in advance.


--James
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

An inner join is just a join between tables where the rows returned are only those which satisfy the join condition. So:

would be an inner join.

An outer join is one which returns all the rows you would get from an inner join, plus some from one table which do not satisfy the join condition. Suppose you did this:

You would get all the records our first join gives us (i.e. everything where table_a.id = table_b.table_a_id) plus all table_a records whose id does not appear in table_b's table_a_id attribute. Does that make any sense?

(And don't worry - general SQL questions often appear and are answered in here)
[ June 23, 2005: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between inner and outer joins
 
Similar Threads
A query in naming conventions of Oracle Joins
inner join Vs outer join
Help!!! Telephone Interview
Hibernate Hell
Difference between static inner class and inner class