Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL-92 Compliant
Jim Smith <jim_at_jimsmith.demon.co.uk> wrote in article
<+4F2AQAeUNcyEwEX_at_jimsmith.demon.co.uk>...
... [Stuff on inner joins SNIPPED]
> To specify an outer join add '(+)' to the columns in the where clause.
>
> select ename,dept.dname
> from emp, dept
> where emp.dname(+) = dept.dname
>
> will give you empleoyees and all departments even if there are no
> employees. This is a LEFT OUTER JOIN (I think)
> --
> Jim Smith
You are absolutely correct about the inner join case; unfortunately, the outer join syntax used by Oracle (and the "*=" syntax used in old MS SQL Server and Sybase) won't cover all cases with more than 2 joins. Unlike inner joins, outer joins are not associative, so that T1 oj (T2 oj T3) is not the same as (T1 oj T2) oj T3. You really do need the SQL-92 syntax to do outer joins properly.
-- Raimundo Comas | Views and opinions in this Computer Scientist | message are MINE! ALL MINE! Comshare, Inc. | and not my employer's (but rcomas_at_comshare.com | they'd probably agree with me)Received on Fri Oct 25 1996 - 00:00:00 CDT
![]() |
![]() |