Difference between INNER JOIN and WHERE?

后端 未结 2 1941
广开言路
广开言路 2020-12-16 05:26

First Query:

Select * from table1 inner join table2 on table1.Id = table2.Id

Second Query:



        
2条回答
  •  失恋的感觉
    2020-12-16 06:04

    To amplify @Akram's answer - many people prefer the inner join syntax, since it then allows you to more easily distinguish between the join conditions (how the various tables in the FROM clause relate to each other) from the filter conditions (those conditions that should be used to reduce the overall result set. There's no difference between them in this circumstance, but on larger queries, with more tables, it may improve readability to use the inner join form.

    In addition, once you start considering outer joins, you pretty well need to use the infix join syntax (left outer join,right outer join), so many find a form of symmetry in using the same style for inner join. There is an older deprecated syntax for performing outer joins in the WHERE clause (using *=), but support for such joins is dying out.

提交回复
热议问题