MySQL优化之in,exists,not in,not exists的区别in与existsin查询过程结论:exists查询过程:结论:not in与not existsnot in查询过程:结论:not exists查询过程:结论:
首先我们使用两个用户表作为实例
insert into A (id,username) values (1,'张三');
insert into A (id,username) values (2,'李四');
insert into B (id,phone)