René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

ANSI inner join

create table table_one (
  col_one number,
  col_two number
);
create table table_two (
  col_one number,
  col_two number
);
insert into table_one values ( 1, 1);
insert into table_one values ( 3, 5);
insert into table_one values ( 5, 9);

insert into table_two values ( 4, 5);
insert into table_two values ( 6, 3);
insert into table_two values ( 5, 5);
select * from 
  table_one t1 inner join 
  table_two t2 on t1.col_one = t2.col_two;
   COL_ONE    COL_TWO    COL_ONE    COL_TWO
---------- ---------- ---------- ----------
         5          9          4          5
         3          5          6          3
         5          9          5          5
select * from 
  table_one t1 inner join 
  table_two t2 using (col_two);
Note: col_two is only returned once here instead of twice when using is used instead of on. This is because it must be the same value:
   COL_TWO    COL_ONE    COL_ONE
---------- ---------- ----------
         5          3          4
         5          3          5

Links