Thursday, April 4, 2013

Outer Join - Oracle and ANSI SQL Syntax Question

Outer joins are really fun. Well kind of. Anyway, here is an example.

The Optimizer blog from Oracle is very useful as well. Oracle Optimizer Team Blog

The setup.


create table  foo (foo1 number, foo2 varchar2(5),foo3 varchar2(10));

insert into foo values (1,'In1','Coming');
insert into  foo values (1,'Out1','Going');
insert into  foo values (2,'In2','Coming');
commit;

select * from foo;

FOO1
FOO2
FOO3
1
In1
Coming
1
Out1
Going
2
In2
Coming

 We need the following output for a report.

 
FOO1
FOO2
FOO2
1
In1
Out1
2
In2
(Null)

 
Try this for yourself. The answer is in the next blog.

An excellent reference.


 




 

No comments:

Post a Comment