What's the difference between NOT EXISTS vs. NOT IN vs. LEFT JOIN WHERE IS NULL?

前端 未结 5 952
独厮守ぢ
独厮守ぢ 2020-11-22 00:56

It seems to me that you can do the same thing in a SQL query using either NOT EXISTS, NOT IN, or LEFT JOIN WHERE IS NULL. For example:

SELECT a FROM table1          


        
5条回答
  •  星月不相逢
    2020-11-22 01:26

    Performance perspective always avoid using inverse keywords like NOT IN, NOT EXISTS, ... Because to check the inverse items DBMS need to runs through all the available and drop the inverse selection.

提交回复
热议问题