Oracle SQL: Meaning of (+)= in WHERE clause

旧街凉风 提交于 2019-12-11 10:22:05

问题


I have a question about the using of (+)= in the where clause in Oracle database;

  1. a. id= b.id(+)

Does that mean a left join that a left join on b where a.id=b.id, right?

  1. a.Job_Type(+) = 'Manager'

I don't understand why he uses (+)= here, but not a.Job_Type = 'Manager', are they the same?


回答1:


The (+) identifies the table that is being outer joined to. The way I was taught, the (+) indicated the table that would have missing rows for which new NULL rows had to be added.

If you look at the alternate left outer join syntaxes that various databases supported before LEFT OUTER JOIN became part of the ANSI standard, the proprietary operator was generally applied to the table that was "missing" rows. DB2 also supports the (+) operator for outer joins in the same way that Oracle does.

Answer: Old Style Oracle Outer Join Syntax - Why locate the (+) on the right side of the equals sign in a Left Outer join?




回答2:


it works like LEFT JOIN and RIGHT JOIN depending on the table that column belong to you can read about different types of JOINS here

in your case (+) will return the all records from table which has alias a and only those records from table which has alias b that intersect with table alias a.



来源:https://stackoverflow.com/questions/36339510/oracle-sql-meaning-of-in-where-clause

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!