Oracle SQL WHERE子句中的(+)符号是什么意思? [英] What does a (+) sign mean in an Oracle SQL WHERE clause?

查看:231
本文介绍了Oracle SQL WHERE子句中的(+)符号是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
Oracle:(+)在WHERE子句中做什么?

Possible Duplicate:
Oracle: What does (+) do in a WHERE clause?

在Oracle数据库环境中考虑以下简化的SQL查询(尽管我不确定它是否特定于Oracle):

Consider the simplified SQL query below, in an Oracle database environment (although I'm not sure that it's Oracle-specific):

SELECT 
   t0.foo, t1.bar
FROM
   FIRST_TABLE t0, SECOND_TABLE t1
WHERE
   t0.ID (+) = t1.ID;

WHERE子句中的(+)表示法是什么?很抱歉,如果这是一个无知的新手问题,但在Google或StackOverflow上很难搜索到它们,因为即使在使用引号的情况下,搜索引擎也会看到"+"号,似乎想将其视为某种逻辑指令.

What is that (+) notation for in the WHERE clause? I'm sorry if this is an ignorant newbie question, but it's been extremely difficult 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.

推荐答案

这是外部连接的Oracle特定表示法.这意味着它将包含来自t1的所有行,如果t0中没有对应的行,则在t0列中使用NULL.

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.

在标准SQL中,人们会这样写:

In standard SQL one would write:

SELECT t0.foo, t1.bar
  FROM FIRST_TABLE t0
 RIGHT OUTER JOIN SECOND_TABLE t1;

Oracle 建议不要再使用这些联接如果您的版本支持ANSI连接(左/右连接):

Oracle建议您使用FROM子句OUTER JOIN语法,而不要使用Oracle 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 SQL WHERE子句中的(+)符号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆