Condition within JOIN or WHERE

后端 未结 9 1803
无人共我
无人共我 2020-11-22 10:16

Is there any difference (performance, best-practice, etc...) between putting a condition in the JOIN clause vs. the WHERE clause?

For example...

-- C         


        
9条回答
  •  借酒劲吻你
    2020-11-22 10:48

    Most RDBMS products will optimize both queries identically. In "SQL Performance Tuning" by Peter Gulutzan and Trudy Pelzer, they tested multiple brands of RDBMS and found no performance difference.

    I prefer to keep join conditions separate from query restriction conditions.

    If you're using OUTER JOIN sometimes it's necessary to put conditions in the join clause.

提交回复
热议问题