SQL left join vs multiple tables on FROM line?

前端 未结 11 2368
予麋鹿
予麋鹿 2020-11-22 05:08

Most SQL dialects accept both the following queries:

SELECT a.foo, b.foo
FROM a, b
WHERE a.x = b.x

SELECT a.foo, b.foo
FROM a
LEFT JOIN b ON a.x = b.x
         


        
11条回答
  •  隐瞒了意图╮
    2020-11-22 05:51

    I think there are some good reasons on this page to adopt the second method -using explicit JOINs. The clincher though is that when the JOIN criteria are removed from the WHERE clause it becomes much easier to see the remaining selection criteria in the WHERE clause.

    In really complex SELECT statements it becomes much easier for a reader to understand what is going on.

提交回复
热议问题