vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
db2 => select tab1.*, childname from tab1 full outer join tab2 on
tab1.empno = tab2.empno
db2 => select tab1.*, childname from tab1 left outer join tab2 on
tab1.empno = tab2.empno
db2 => select tab1.*, childname from tab1 right outer join tab2 on
tab1.empno = tab2.empno
D:\PROGRA~1\SQLLIB\BIN>db2 select * from tab1
EMPNO NAME
----------- --------------------
1 a
2 b
3 c
4 d
5 e
5 record(s) selected.
D:\PROGRA~1\SQLLIB\BIN>db2 select * from tab2
EMPNO CHILDNAME
----------- --------------------
1 a
3 c
4 d
7 x
4 record(s) selected.
D:\PROGRA~1\SQLLIB\BIN>db2 select tab1.*, childname from tab1 left outer
join tab2 on tab1.empno = tab2.empn
o
EMPNO NAME CHILDNAME
----------- -------------------- --------------------
1 a a
2 b -
3 c c
4 d d
5 e -
5 record(s) selected.
D:\PROGRA~1\SQLLIB\BIN>db2 select tab1.*, childname from tab1 right outer
join tab2 on tab1.empno = tab2.emp
no
EMPNO NAME CHILDNAME
----------- -------------------- --------------------
1 a a
3 c c
4 d d
- - x
4 record(s) selected.
D:\PROGRA~1\SQLLIB\BIN>db2 select tab1.*, childname from tab1 full outer
join tab2 on tab1.empno = tab2.empn
o
EMPNO NAME CHILDNAME
----------- -------------------- --------------------
1 a a
3 c c
4 d d
- - x
2 b -
5 e
- |
|