You must Sign In to post a response.

INNER JOIN vs WHERE

What is the difference between Inner Join and where clause.
It is just personal choice to use either or is one benifits over other.

Please reply


Comments

Author: Rajesh Ranjan07 Jan 2009 Member Level: Gold   Points : 2

Hi friend,



It's very simple, Any type of join, join two or more then two tables but where condition can't join table.
same for inner Join also.

Regards
Rajesh Ranjan

Author: Preet07 Jan 2009 Member Level: Gold   Points : 3

As far as I know both of the following queries will producr same result:-


SELECT tb1.a,tb1.b,tb2.c
FROM tb1, tb2
WHERE tb1.a=tb2.a

SELECT tb1.a,tb1.b,tb2.c
FROM tb1
INNER JOINE tb2
ON tb1.a=tb2.a

that means same task can be done by INNER JOIN and WHERE

thats why i want to know the difference.

Author: Suresh.B07 Jan 2009 Member Level: Bronze   Points : 4

Hi Preet,

Inner Join is Entirely different from WHERE clause..

Inner Join is Used to Extract the Data's from 1 or more tables Where as WHERE clause is a conditional Statement...

For (Eg)

Select * From Table1
Inner Join Table2 On Table1.Field = Table2.Field
Where TAble1.Field = Contional Statement.

Here Inner Join Used to Extract data's from 2 Tables but where condition is used to extract the particular record which satisfies the condition.

Hope U got...

Regards,
SureshB

Author: Babu Akkandi07 Jan 2009 Member Level: Gold   Points : 2

Hi,

Both are having same functionality. No performance difference for INNER JOIN.

Advantage of using Inner Join is: clarity and ease of understanding, also it is standard SQL

Only difference is synatx of using

Hope it Helps!

Author: divya07 Jan 2009 Member Level: Gold   Points : 2

Hi,
No performance difference btwn both
advantage for join: clarity and ease of understanding, also it is standard sql

no performance difference for INNER JOIN

Author: Tejinder Singh Barnala08 Jan 2009 Member Level: Gold   Points : 4

where this discuusion is going,

select * from a,b
where a.id = b.id

or

select * from a
inner join b on b.id = a.id

both are syntax of inner join, first one is ansi standard for writting inner join
second one is T-sql standard

then how there can be any difference between execution of both

the only differnce is that while using ansi standard join you can't tell which type of value lookup is used for that join suppose
you want matching value trough nested loop then you can define it in t-sql standard join
as

select * from a
inner loop join b on b.id = a.id

that's what i know, if i am wrong, please correct me