Why isn't SQL ANSI-92 standard better adopted over ANSI-89?

后端 未结 16 1762
日久生厌
日久生厌 2020-11-22 10:59

At every company I have worked at, I have found that people are still writing their SQL queries in the ANSI-89 standard:

select a.id, b.id, b.address_1
from          


        
16条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 11:24

    I had a query that was originally written for SQL Server 6.5, which did not support the SQL 92 join syntax, i.e.

    select foo.baz
    from foo
      left outer join bar
      on foo.a = bar.a
    

    was instead written as

    select foo.baz
    from foo, bar
    where foo.a *= bar.a
    

    The query had been around for a while, and the relevant data had accumulated to make the query run too slow, abut 90 seconds to complete. By the time this problem arose, we had upgraded to SQL Server 7.

    After mucking about with indexes and other Easter-egging, I changed the join syntax to be SQL 92 compliant. The query time dropped to 3 seconds.

    There's a good reason to switch.

    Reposted from here.

提交回复
热议问题