Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site seismo.CSS.GOV Path: utzoo!watmath!clyde!burl!ulysses!gatech!seismo!tiberio From: tiberio@seismo.CSS.GOV (Mike Tiberio) Newsgroups: net.database Subject: outer joins Message-ID: <41@seismo.CSS.GOV> Date: Fri, 23-Aug-85 11:43:29 EDT Article-I.D.: seismo.41 Posted: Fri Aug 23 11:43:29 1985 Date-Received: Sun, 25-Aug-85 05:25:04 EDT Organization: Center for Seismic Studies, Arlington, VA Lines: 40 I just dug out the ORACLE manual page my buddy sent to me when I asked him about outer joins. Example given: > select emp.*, dname, loc > from dept, emp > where dept.deptno = emp.deptno(+) > and empno is null OR: > select empno, ename, job, sal, emp.deptno, dname, loc > from emp, dept > where loc in ('Chicago', 'D.C.') > and dept.deptno = emp.deptno(+) What they have to say about it is: > The outer join notation (+) is used to indicate that the table which may be > missing entries shall be treated as though it had an additional row which will > be joined to any row of the other table which would be otherwise discarded. In > the example above, emp is the table which perhaps is missing one or two > departments, so it is augmented with (+) so that all the dept rows will be > selected. Some will be aligned with real rows of emp, others with a null row. The above was taken (and reproduced) without permission from page 64 of some ORACLE documentation section labled 'SQL statements'. It is interesting to note that this method of outer join prints null values (" ",0's) for the missing emp rows. Since INGRES has no such (+) operator the method given in RTI's INGRES Applicatioon Notes, which requires the addition of the null row to the lacking relation, essentially allows (forces) the user to choose what 'null' values get returned. This could be useful if in your database definition you have null values other than zero and white space. In our databases here at the Center for Seismic Studies we use underscore for character nulls and -1 for most numeric nulls. Of cource ORACLE users could forgo the (+) operator and use the same method RTI suggests. seismo!tiberio