• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Left outer join or Right outer join on Oracle

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have two tables: employee and department. The employee table has a foreign key dep_id pointing to the primary key, dep_id, of the department table.

Outer Left Join: SELECT d.name, e.name FROM department d, employee e WHERE d.dep_id = e.dep_id (+);

Do I get a Outer Right Join by just switching the sides on equal sign (=) like following?
SELECT d.name, e.name FROM department d, employee e WHERE e.dep_id (+) = d.dep_id;

They are both valid SQL statements. I guess the result set should be the same. Correct?


 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, the two statements are identical.

Similarly with the ANSI syntax, a left join can always be expressed as a right join (and vice versa), simply by reversing the order of the tables.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic