Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: does oracle support natural joins

Re: does oracle support natural joins

From: Alan Shein <alanshein_at_erols.com>
Date: Mon, 6 Dec 1999 12:33:35 -0500
Message-ID: <82gs14$669$1@autumn.news.rcn.net>


Oracle does not support a Natural Join syntax. You would have to list the specific columns you _do_ want in the SELECT statement. So,

SELECT *
FROM t1, t2
WHERE t1.pk = t2.pk

would result in the pk showing twice in the results, but that is the only case where you would be "forced" to see the same column twice. You'd have to go out of your way otherwise:

SELECT t1.pk, t1.col1, t1.col2, t2.pk, t2.other_col, etc... FROM t1,t2
WHERE t1.pk = t2.pk

You would normally not do this, but instead would do

SELECT t1.pk, t1.col1, t1.col2, t2.other_col, etc... FROM t1,t2
WHERE t1.pk = t2.pk

In my experience, one does not usually need to SELECT * from more than one table, so the lack of a natural join syntax is no big deal.

If you are really selecting specific columns (as you state select x,y), then a natural join is not relevant anyway, unless you happen to select the same data items from each table.

<bubbashrimp_at_my-deja.com> wrote in message news:82gkcg$f2p$1_at_nnrp1.deja.com...
> I doubt this would be on an exam :). I just wanted to know if any
> verson of oracle supports the natural join syntax;
> select x,y from tableA natural join tableB
> If tableA and tableB share a column with named z it would be joined on
> that column. Sybase supports this and it would make my persistence layer
> so much easier to write, however other db's do not support this (db2) ;
> And I need to run on many DB's . I may have been incorrect about this
> being part of the sql 92 standard , does anybody know ?
>
>
> In article <828lvj$7qo$1_at_autumn.news.rcn.net>,
> "Alan Shein" <alanshein_at_erols.com> wrote:
> > This sounds like a question on a final exam. If not, what do you
> _really_
> > need to know (from a business rules point of view), or in other words
> what
> > prompted the question? It's not a usual thing to ask.
> >
> > <bubbashrimp_at_my-deja.com> wrote in message
> > news:826ml6$s4r$1_at_nnrp1.deja.com...
> > > does oracle support natural joins per sql 92 standard ? If so which
> > > versions ? Thanx!
> > >
> > >
> > > Sent via Deja.com http://www.deja.com/
> > > Before you buy.
> >
> >
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Mon Dec 06 1999 - 11:33:35 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US