Using Joins

From: <shweta.kaparwan_at_googlemail.com>
Date: Sun, 31 May 2009 00:45:02 -0700 (PDT)
Message-ID: <1a860bf3-7a4e-41fe-a68d-ee4dbd9bd645_at_t11g2000vbc.googlegroups.com>



All,

I have tables a and b as follows,

SQL> select * from a
  2 /

         X Y
---------- ------------------------------

         1 A1
         2 A2
         3 A3
         4 A4
           A99

SQL> select * from b;

         X Y
---------- ------------------------------

         3 B3
         4 B4
         5 B5
         6 B6

Query1:

SQL> select a.x,count(b.x) from a , b where a.x = b.x(+) and a.x is not null group by a.x order by
a.x;

         X COUNT(B.X)
---------- ----------

         1          0
         2          0
         3          1
         4          1

Query2:

SQL> select a.x,count(b.x) from a LEFT OUTER JOIN b ON a.x = b.x and a.x is not null group by a.x
order by a.x;

         X COUNT(B.X)
---------- ----------

         1          0
         2          0
         3          1
         4          1
                    0

Question :
Since keyword (+) can be avoided if we use the ANSI equivalent keyword LEFT OUTER JOIN then why
there is a difference in the output using using (+) ( query1) and using LEFT OUTER JOIN (query2) ?

Regards Received on Sun May 31 2009 - 02:45:02 CDT

Original text of this message