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

前端 未结 5 907
独厮守ぢ
独厮守ぢ 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:28

    When need to insert data in table with multi-field primary key, consider that it will be much faster (I tried in Access but I think in any Database) not to check that "not exists records with 'such' values in table", - rather just insert into table, and excess records (by the key) will not be inserted twice.

提交回复
热议问题