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

Home -> Community -> Usenet -> c.d.o.server -> Re: Outer Join Syntax

Re: Outer Join Syntax

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Thu, 20 Jun 2002 09:42:07 +0100
Message-ID: <1024562626.12174.0.nnrp-01.9e984b29@news.demon.co.uk>

My mind must work the wrong way round:

    a.c = b.c(+)
tells me "intuitively" that I am ADDing a spurious null row to table B that will match any row in A. B is the deficient table that is 'causing' my problem, so I add something to it.

Whereas with

    select ... from a left outer join b on a.c = b.c I find it very hard to remember that I am using a LEFT join because the table on the RIGHT has lost some data ;(

(I would be cautious about making comments about 'sticking the plus sign on the right side of the equals' - some people right their predicate back to front, viz: b.c(+) = a.c)

--
Jonathan Lewis
http://www.jlcomp.demon.co.uk

Next Seminars
        UK            July / Sept
        Australia      July / August
        Malaysia        September
        USA (MI)        November
http://www.jlcomp.demon.co.uk/seminar.html

Howard J. Rogers wrote in message ...

>In other words, you stick the plus on precisely the wrong side of the join.
>
>If it's a left outer join, stick the plus sign on the right side of the "="
>test.
>
>If it's a right outer join, stick it on the left side.
>
>Highly intuitive, I think you'll agree.
>
>Regards
>HJR
>
>
>"Raphael Ploix" <raphael.ploix_at_threex.co.uk> wrote in message
>news:3d10822b$0$8514$ed9e5944_at_reading.news.pipex.net...
>> left outer joins work like this:
>>
>> select ... from a left outer join b on a.c = b.c
>>
>> is equivalent to
>>
>> select ... from a, b where a.c = b.c(+)
>>
>> table b is the 'optional' data in both cases: (+) in Oracle SQL, left
>outer
>> join in ANSI.
>>
>> Hope this helps.
>>
>> Raphael
>>
>>
>>
Received on Thu Jun 20 2002 - 03:42:07 CDT

Original text of this message

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