Oracle SQL WHERE 子句中的 (+) 符号是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4217293/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does a (+) sign mean in an Oracle SQL WHERE clause?
提问by Steve Perkins
Possible Duplicate:
Oracle: What does(+)
do in a WHERE clause?
Consider the simplified SQL query below, in an Oracle database environment (although I'm not sure that it's Oracle-specific):
在 Oracle 数据库环境中考虑下面的简化 SQL 查询(尽管我不确定它是否特定于 Oracle):
SELECT
t0.foo, t1.bar
FROM
FIRST_TABLE t0, SECOND_TABLE t1
WHERE
t0.ID (+) = t1.ID;
What is that (+)
notation for in the WHERE
clause? I'm sorry if this is an ignorant newbie question, but it's been extremelydifficult to search for on Google or StackOverflow... because even when using quote marks, search engines see a '+' sign and seem to want to treat it as some kind of a logical directive.
子句中的(+)
符号是什么WHERE
?如果这是一个无知的新手问题,我很抱歉,但是在 Google 或 StackOverflow 上搜索非常困难……因为即使使用引号,搜索引擎也会看到“+”号,并且似乎想将其视为某种逻辑指令。
采纳答案by Benoit
This is an Oracle-specific notation for an outer join. It means that it will include all rows from t1, and use NULLS in the t0 columns if there is no corresponding row in t0.
这是用于外连接的 Oracle 特定表示法。这意味着它将包含 t1 中的所有行,如果 t0 中没有相应的行,则在 t0 列中使用 NULLS。
In standard SQL one would write:
在标准 SQL 中,人们会这样写:
SELECT t0.foo, t1.bar
FROM FIRST_TABLE t0
RIGHT OUTER JOIN SECOND_TABLE t1;
Oracle recommends not to use those joins anymore if your version supports ANSI joins (LEFT/RIGHT JOIN):
如果您的版本支持 ANSI 连接 (LEFT/RIGHT JOIN),Oracle建议不要再使用这些连接:
Oracle recommends that you use the FROM clause OUTER JOIN syntax rather than the Oracle join operator. Outer join queries that use the Oracle join operator (+) are subject to the following rules and restrictions […]
Oracle 建议您使用 FROM 子句 OUTER JOIN 语法而不是 Oracle 连接运算符。使用 Oracle 连接运算符 (+) 的外连接查询受以下规则和限制 […]