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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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); |
| |||
| 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 |
| |||
| 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 -- |
| |||
| 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. |
| ||||
| 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. |