Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inner join versus outer join 1

Status
Not open for further replies.

styvo

Programmer
Aug 24, 2006
1
US
I am not new to DB2 but have never been glib in the use of terms used in the field and until now never questioned the use of the term 'inner join'.

I have looked all through several popular publications and have not yet found a real definition of outer joins and inner joins.

Could some one provide a clear definition on these and how they are used.

Thank you
 
Perhaps a little example will work nicely here.

Imagine a table storing customers and a second table storing orders.
The customer id exist in both tables.
Some customers have placed orders, some have not placed any.

Joining these tables (over customer_id) and fetching all fields from both tables:

1. Inner join

Yields only information from customer table for customers having placed orders.

2. Outer join

Yields information from all customers (orders or not)

This is generic and is not DB2 specific.

There are more variations like the full outer join and the exception join, but I hope that this example is a start:

recommended:




Ties Blom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top