何时或为何使用右外连接而不是左连接? [英] When or why would you use a right outer join instead of left?

查看:33
本文介绍了何时或为何使用右外连接而不是左连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

维基百科声明:

在实践中,很少使用显式右外连接,因为它们总是可以被左外连接替换并且不提供额外的功能."

"In practice, explicit right outer joins are rarely used, since they can always be replaced with left outer joins and provide no additional functionality."

谁能提供一个他们更喜欢使用正确符号的情况,为什么?我想不出使用它的理由.对我来说,它永远不会让事情变得更清楚.

Can anyone provide a situation where they have preferred to use the RIGHT notation, and why? I can't think of a reason to ever use it. To me, it wouldn't ever make things more clear.

我是一名 Oracle 资深人士,正在制定新年决议以摆脱 (+) 语法.我想做对

I'm an Oracle veteran making the New Year's Resolution to wean myself from the (+) syntax. I want to do it right

推荐答案

我能想到的使用 RIGHT OUTER JOIN 的唯一原因是试图让你的 SQL 更加自文档化.

The only reason I can think of to use RIGHT OUTER JOIN is to try to make your SQL more self-documenting.

您可能希望对在一对多关系的从属(多)侧具有空行的查询使用左联接,对在独立侧生成空行的查询使用右联接.

You might possibly want to use left joins for queries that have null rows in the dependent (many) side of one-to-many relationships and right joins on those queries that generate null rows in the independent side.

这也可能发生在生成的代码中,或者如果商店的编码要求在 FROM 子句中指定了表的声明顺序.

This can also occur in generated code or if a shop's coding requirements specify the order of declaration of tables in the FROM clause.

这篇关于何时或为何使用右外连接而不是左连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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