The story of JOINS in SQL is to get data from many tables. Actually in DB2 there are both LEFT and RIGHT outer JOINS present.
There is no difference between a left outer join and right outer join other than where the starting driver is coded
SELECT D.DEPTNO, D.DEPTNAME, D.MGRNO, E.LASTNAME FROM DEPT D LEFT JOIN EMP E ON D.MGRNO = E.EMPNO
SELECT D.DEPTNO, D.DEPTNAME, D.MGRNO, E.LASTNAME FROM EMP E RIGHT JOIN DEPT D ON D.MGRNO = E.EMPNO
When you give LEFT join, the driver table is left side one. When you give RIGHT join, then the drive table is right side one.
- DB2 itself converts RIGHT JOIN into LEFT JOIN during query processing
- Main thing is, to avoid confusion, always code LEFT OUTER join
- Real logic you need to connect DB2 using PHP engine
- Top DB2 privileges really useful for certification seekers
- DB2 UDF sample function read now with awesome interview question
- Real reason why Left outer JOIN only you need to use in DB2 SQL