When or why would you use a right outer join instead of left?

后端 未结 11 675
小蘑菇
小蘑菇 2020-11-27 05:47

Wikipedia states:

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

11条回答
  •  日久生厌
    2020-11-27 06:17

    SQL statements, in addition to being correct, should be as easy to read and expressively concise as possible (because they represent single atomic actions, and your mind needs to grok them completely to avoid unintended consequences.) Sometimes an expression is more clearly stated with a right outer join.

    But one can always be transformed into the other, and the optimizer will do as well with one as the other.

    For quite a while, at least one of the major rdbms products only supported LEFT OUTER JOIN. (I believe it was MySQL.)

提交回复
热议问题