让我清楚了解 Oracle 9i 中的外连接
在我看来,外连接有点令人困惑。
有谁能给我一张外连接(右、左和全)的清晰图片吗?
Outer joins seem to me a little bit confusing.
Is there anyone can get me a clear picture of outer joins (right, left and full)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
原始问题/答案:https://stackoverflow.com/questions/3308122/how-do-i-decide-when-to-use-right-join-left-join- or-inner-join-or-how-to-deter/3308153#3308153
阅读这篇关于 代码项目将为您提供很大帮助:Visual SQL 连接的表示。
Orginal question/answer: https://stackoverflow.com/questions/3308122/how-do-i-decide-when-to-use-right-join-left-join-or-inner-join-or-how-to-deter/3308153#3308153
Reading this original article on The Code Project will help you a lot: Visual Representation of SQL Joins.
有关连接的维基百科文章应该会对您有所帮助。
Oracle 外连接的特殊之处在于使用
(+)
的旧表示法,但现在它已经过时了。The Wikipedia article about Joins should help you.
The special thing about Oracle Outer joins was the old notation using
(+)
, but it is obsolete now.我一直认为它的方式是:
很容易记住,无需查阅维基百科或绘制图表。
PS Oracle + join 语法之死!
The way I always think of it is:
Easy to keep in your head, without going to Wikipedia or drawing diagrams.
P.S. Death to Oracle + join syntax!
我从来不喜欢@Pranay Rana 的答案中使用的那些常见图片。它们显示集合操作但不显示连接。例如,顶部中间的图片是
A union B
,左边中间的图片是A except B
(或者我认为Oracle的A minus B
) , 等等。还要考虑到 null 在关系模型中不存在,所以无论如何你都无法使用维恩图来绘制它! ;)
我认为不使用表就无法绘制外连接的图片,例如 这个。
I've never liked those oft seen pictures used in @Pranay Rana's answer. They show set operations but not joins. For example, the top middle picture is
A union B
, the left middle isA except B
(or I supposeA minus B
for Oracle), and so on.Also consider that null does not exist in the relational model, so you can't draw a picture of it using a Venn diagrams anyway! ;)
I don't think one can draw a picture of an outer join without using tables, such as this one.