TSQL - SOME | ANY why are they same with different names?

后端 未结 5 440
滥情空心
滥情空心 2021-01-07 20:19

According to MSDN BOL (Books Online) description on SOME | ANY (Transact-SQL),

SOME and ANY are equivalent.

It does make sense t

5条回答
  •  醉话见心
    2021-01-07 21:04

    SOME and ANY are equivalent. ANY is ANSI syntax. Why SOME is introduced, I do not know. Could be because of readability, but both of next two sentences are easy to understand.

    WHERE 5000 < ANY(SELECT Price FROM dbo.items)
    WHERE 5000 < SOME(SELECT Price FROM dbo.items)
    

    Although, SQL server will in both cases execute:

    WHERE EXISTS(SELECT * FROM dbo.items WHERE price>5000)
    

    which is also very easy to understand.

提交回复
热议问题