sql-server – SQL Server:在vs或?中选择?

哪个更快?

SELECT UserName
FROM dbo.UserTable
WHERE UserID in (1,3,4)
SELECT UserName
FROM dbo.UserTable
WHERE UserID = 1 
      OR UserID = 3
      OR UserID = 4
由于Sql Server对查询的优化,这些将以相同的速度运行,因为它们在逻辑上相当.

我赞成IN语法的简洁和可读性.

相关文章
相关标签/搜索