Unix Technical Forum

newbie question about join

This is a discussion on newbie question about join within the Oracle Miscellaneous forums, part of the Oracle Database category; --> I'm a little bit confused, are these two select statements synonymous? The second one has a 'join...on', while the ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 12:21 PM
sean nakasone
 
Posts: n/a
Default newbie question about join

I'm a little bit confused, are these two select statements synonymous?
The second one has a 'join...on', while the first one does not.

select t.* from user_tab_cols t, user_all_tables a
where t.table_name = a.table_name;

select t.* from user_tab_cols t join user_all_tables a
on (t.table_Name = a.table_name);


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 12:21 PM
DA Morgan
 
Posts: n/a
Default Re: newbie question about join

sean nakasone wrote:
> I'm a little bit confused, are these two select statements synonymous?
> The second one has a 'join...on', while the first one does not.
>
> select t.* from user_tab_cols t, user_all_tables a
> where t.table_name = a.table_name;
>
> select t.* from user_tab_cols t join user_all_tables a
> on (t.table_Name = a.table_name);


One is ISO syntax the other ANSI. They are both inner joins.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 12:21 PM
Mark D Powell
 
Posts: n/a
Default Re: newbie question about join

On Feb 23, 7:34 pm, DA Morgan <damor...@psoug.org> wrote:
> sean nakasone wrote:
> > I'm a little bit confused, are these two select statements synonymous?
> > The second one has a 'join...on', while the first one does not.

>
> > select t.* from user_tab_cols t, user_all_tables a
> > where t.table_name = a.table_name;

>
> > select t.* from user_tab_cols t join user_all_tables a
> > on (t.table_Name = a.table_name);

>
> One is ISO syntax the other ANSI. They are both inner joins.
> --
> Daniel A. Morgan
> University of Washington
> damor...@x.washington.edu
> (replace x with u to respond)
> Puget Sound Oracle Users Groupwww.psoug.org


Another way to describe these would be to say that the first is the
traditional syntax for writing a join while the second is the newer
syntax introduced in the ANSI-92 standard. Both methods are fully
compatiable with the most recent ANSI standard and I am unaware of any
differences between the ANSI and ISO standards on join syntax.

An excellent book on SQL from Apress is "Mastering Oracle SQL and
SQL*Plus" by the late Lex de Haan. Lex worked for Oracle from 1990 -
2004 and worked with the ISO standard committee.

HTH -- Mark D Powell --

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 12:21 PM
Thorsten Kettner
 
Posts: n/a
Default Re: newbie question about join

On 24 Feb., 00:10, sean nakasone <seannakas...@yahoo.com> wrote:
> I'm a little bit confused, are these two select statements synonymous?
> The second one has a 'join...on', while the first one does not.
>
> select t.* from user_tab_cols t, user_all_tables a
> where t.table_name = a.table_name;
>
> select t.* from user_tab_cols t join user_all_tables a
> on (t.table_Name = a.table_name);


Yes they are identical. I recommend using the second notation, because
when it comes to joining more tables your statement will be much more
readable as you state each table's join conditions next it instead of
having them placed somewhere in a huge where clause.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 12:21 PM
William Robertson
 
Posts: n/a
Default Re: newbie question about join

On Feb 23, 11:10 pm, sean nakasone <seannakas...@yahoo.com> wrote:
> I'm a little bit confused, are these two select statements synonymous?
> The second one has a 'join...on', while the first one does not.
>
> select t.* from user_tab_cols t, user_all_tables a
> where t.table_name = a.table_name;
>
> select t.* from user_tab_cols t join user_all_tables a
> on (t.table_Name = a.table_name);


btw the syntax does not require brackets.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:21 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com