Inner join vs Where

后端 未结 19 1303
庸人自扰
庸人自扰 2020-11-22 05:20

Is there a difference in performance (in oracle) between

Select * from Table1 T1 
Inner Join Table2 T2 On T1.ID = T2.ID

And



        
19条回答
  •  忘了有多久
    2020-11-22 05:54

    In a scenario where tables are in 3rd normal form, joins between tables shouldn't change. I.e. join CUSTOMERS and PAYMENTS should always remain the same.

    However, we should distinguish joins from filters. Joins are about relationships and filters are about partitioning a whole.

    Some authors, referring to the standard (i.e. Jim Melton; Alan R. Simon (1993). Understanding The New SQL: A Complete Guide. Morgan Kaufmann. pp. 11–12. ISBN 978-1-55860-245-8.), wrote about benefits to adopt JOIN syntax over comma-separated tables in FROM clause.

    I totally agree with this point of view.

    There are several ways to write SQL and achieve the same results but for many of those who do teamwork, source code legibility is an important aspect, and certainly separate how tables relate to each other from specific filters was a big leap in sense of clarifying source code.

提交回复
热议问题