旧式Oracle外连接语法-为什么在左外连接的等号右侧找到(+)? [英] Old Style Oracle Outer Join Syntax - Why locate the (+) on the right side of the equals sign in a Left Outer join?

查看:184
本文介绍了旧式Oracle外连接语法-为什么在左外连接的等号右侧找到(+)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是告诉新人们,记住旧的Oracle外连接语法的一种简单方法是

I always tell new people that an easy way to remember the old-style, Oracle outer-join syntax is that

(+)号位于您认为应该位于的位置的相反侧.

the (+) sign is on opposite side of where you think it should be.

左加入:

select * from foo, bar
where foo.id = bar.id(+)

右加入:

select * from foo, bar
where foo.id(+) = bar.id

我确定我是在大学里学到的,但是在两边都带有(+)号的目的是什么?它是否仅指示即使另一侧的那些行在这一侧不匹配"?但这似乎太复杂了.选择(+)"并将其放在没有匹配的一侧的目的是什么?

I'm sure I learned this in college, but what is the purpose of having the (+) sign on either side? Does it simply indicate "even those rows on the other side that don't match on this side"? but that would seem too complicated. What was the purpose of choosing "(+)" and putting it on the side where no match was made?

推荐答案

(+)标识正在外部联接的表.按照我的教导方式,(+)表示表中缺少行,必须为其添加新的NULL行.

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.

如果您查看的左外部连接的替代语法LEFT OUTER JOIN成为ANSI标准的一部分之前受支持的数据库,通常将专有运算符应用于缺少"行的表. DB2还支持(+)运算符进行外部联接与Oracle相同.

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.

这篇关于旧式Oracle外连接语法-为什么在左外连接的等号右侧找到(+)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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