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
- DB2 UDF sample function read now with awesome interview question
- Real idea Left outer JOIN you always need to code in DB2 read now
- 3 top rules to write alias instead of Table column name in SQL query
- 4 top DB2 host variable points you need to know before write program