Forums » .NET » SQL Server »

INNER JOIN vs WHERE


Posted Date: 07 Jan 2009      Posted By:: Preet     Member Level: Gold    Member Rank: 78     Points: 1   Responses: 6



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




Responses

#335715    Author: Rajesh Ranjan      Member Level: Gold      Member Rank: 0     Date: 07/Jan/2009   Rating: 2 out of 52 out of 5     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


 
#335717    Author: Preet      Member Level: Gold      Member Rank: 78     Date: 07/Jan/2009   Rating: 2 out of 52 out of 5     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.


 
#335723    Author: Suresh.B      Member Level: Bronze      Member Rank: 0     Date: 07/Jan/2009   Rating: 2 out of 52 out of 5     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





 
#335732    Author: Babu Akkandi      Member Level: Gold      Member Rank: 54     Date: 07/Jan/2009   Rating: 2 out of 52 out of 5     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!

Thanks and Regards,
Babu Akkandi


 
#335803    Author: divya      Member Level: Gold      Member Rank: 356     Date: 07/Jan/2009   Rating: 2 out of 52 out of 5     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


 
#335914    Author: Tejinder Singh Barnala      Member Level: Gold      Member Rank: 382     Date: 08/Jan/2009   Rating: 2 out of 52 out of 5     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

Many Thanks
Tejinder Singh Barnala
/*I have the simplest tastes. I am always satisfied with the best*/


 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Return to Discussion Forum
Start new thread

Subscribe to Subscribers
Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Talk to Webmaster Tony John

Online Members

Shubhangi
More...
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India