什么时候或为什么你会使用右外连接而不是左? [英] When or why would you use a right outer join instead of left?
问题描述
维基百科说明:
在实践中,很少使用显式的右外连接,因为它们总是可以用左外连接替换,不提供其他功能。
"In practice, explicit right outer joins are rarely used, since they can always be replaced with left outer joins and provide no additional functionality."
提供他们喜欢使用RIGHT符号的情况,为什么?
我不能想到一个理由来使用它。对我来说,它不会使事情更清楚。
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屋!