Subject Correct method for joining tables
Author Stephen Wood
Hi guys 'n gals,

I've always wondered what the correct procedure is for joining tables using
the inner join or left/right outer joins....

Method 1:

Select blah, blah, blah
From Table1
Inner join Table2 on (Table1.PK_ID = 5 and Table2.FK_ID = Table1.PK_ID)

Method 2:
Select blah, blah, blah
From Table1
Inner join Table2 on (Table2.FK_ID = Table1.PK_ID)
Where Table1.PK_ID = 5

My logic says that Method 1 is the correct way because you are limiting the
result set at the table joins, instead of Method 2 where you are joining all
records from both tables, and then the Where clauses is creating a subset of
the total result set....

Am I correct in my thinking, or does the database engine optimize the query
regardless of the method you use?

Thanks in advance
Steve




[Non-text portions of this message have been removed]