A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Left outer join or Right outer join on Oracle
Joined: Mar 04, 2008
Jul 22, 2012 12:25:52
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?
"Knowing is not enough, you must apply... Willing is not enough, you must do."
Joined: Aug 22, 2010
Jul 23, 2012 03:02:32
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.
subject: Left outer join or Right outer join on Oracle
Allowed ORDER BY fields question
Question for SCBCD aspirants (and gurus)...
are these join same
Doubt regarding joins in SQL...
Cannot understand MySqlQuery Working.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013