Oracle (Old?) Joins - A tool/script for conversion?

前端 未结 6 1029
北恋
北恋 2020-11-27 22:13

I have been porting oracle selects, and I have been running across a lot of queries like so:

SELECT e.last_name,
       d.department_name
  FROM employees e,         


        
6条回答
  •  甜味超标
    2020-11-27 23:08

    The (+) is Oracle specific pre-ANSI-92 OUTER JOIN syntax, because ANSI-89 syntax doesn't provide syntax for OUTER JOIN support.

    Whether it is RIGHT or LEFT is determined by which table & column reference the notation is attached to. If it is specified next to a column associated with the first table in the FROM clause - it's a RIGHT join. Otherwise, it's a LEFT join. This a good reference for anyone needing to know the difference between JOINs.

    First query re-written using ANSI-92 syntax:

        SELECT e.lastname,
               d.department_name
          FROM EMPLOYEES e
    RIGHT JOIN DEPARTMENTS d ON d.departmentid = e.departmentid
    

    Second query re-written using ANSI-92 syntax:

       SELECT e.lastname,
              d.department_name
         FROM EMPLOYEES e
    LEFT JOIN DEPARTMENTS d ON d.departmentid = e.departmentid
    

提交回复
热议问题