|
Home > Archive > Other Oracle database topics > March 2006 > When to use inner join
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
When to use inner join
|
|
| ajay.bisht@gmail.com 2006-03-23, 3:26 am |
| There are two queries:
1. SELECT
RR.*, a.NAME
FROM
T_test1 RR INNER JOIN
T_test2 A
ON
A.CODE =RR.LOCCODE
2.SELECT
RR.*, a.NAME
FROM
T_test1 RR , t_test2 a where A.CODE =RR.LOCCODE
they are giving the same recordset.
--> when to use Inner join
-->Is there any diff. b/w these two queries
| |
|
| There's no difference but just another writing of the same SQL
statement. In both statements an inner join is processed.
Regards,
J=F6rg
| |
| ajay.bisht@gmail.com 2006-03-23, 7:30 am |
| Thankx a lot!!
| |
| Martijn Tonies 2006-03-23, 7:30 am |
|
> There are two queries:
> 1. SELECT
> RR.*, a.NAME
> FROM
> T_test1 RR INNER JOIN
> T_test2 A
> ON
> A.CODE =RR.LOCCODE
>
> 2.SELECT
> RR.*, a.NAME
> FROM
> T_test1 RR , t_test2 a where A.CODE =RR.LOCCODE
>
> they are giving the same recordset.
> --> when to use Inner join
> -->Is there any diff. b/w these two queries
In addition to Sims' answer, I would say that the query
with the explicit JOIN is easier to read.
It will also be more clear if you add joined tables or
modify it to an outer join.
Oh, and the explicit JOIN syntax is the SQL 92 and up
syntax, while writing everything in the WHERE is the
SQL89 syntax.
--
Martijn Tonies
Database Workbench - development tool for Oracle, and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www. databasedevelopmentf
orum.com
| |
| Galen Boyer 2006-03-23, 8:26 pm |
| On Thu, 23 Mar 2006, m.tonies@upscene.removethis.com wrote:
>
>
> In addition to Sims' answer, I would say that the query
> with the explicit JOIN is easier to read.
>
> It will also be more clear if you add joined tables or
> modify it to an outer join.
>
> Oh, and the explicit JOIN syntax is the SQL 92 and up
> syntax, while writing everything in the WHERE is the
> SQL89 syntax.
The biggest win for me is that the tables I'm joining and the criteria
I'm using to join are in the same place. I don't have to visually scan
the where criteria and keep my place, I put the tables and criteria
together. Once I coded a few INNER JOINS and LEFT OUTER JOINS I was
hooked.
--
Galen Boyer
|
|
|
|
|