NOT IN vs NOT EXISTS

前端 未结 11 1527
粉色の甜心
粉色の甜心 2020-11-21 12:08

Which of these queries is the faster?

NOT EXISTS:

SELECT ProductID, ProductName 
FROM Northwind..Products p
WHERE NOT EXISTS (
    SELECT 1 
    FROM         


        
11条回答
  •  一向
    一向 (楼主)
    2020-11-21 12:44

    If the execution planner says they're the same, they're the same. Use whichever one will make your intention more obvious -- in this case, the second.

提交回复
热议问题