SQL left join vs multiple tables on FROM line?

前端 未结 11 2376
予麋鹿
予麋鹿 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:58

    The first way is the older standard. The second method was introduced in SQL-92, http://en.wikipedia.org/wiki/SQL. The complete standard can be viewed at http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt .

    It took many years before database companies adopted the SQL-92 standard.

    So the reason why the second method is preferred, it is the SQL standard according the ANSI and ISO standards committee.

提交回复
热议问题