1
drop table if exists t1;
2
create table t1 (a int, key (a));
3
insert into t1 values (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
4
(10), (11), (12), (13), (14), (15), (16), (17), (18), (19);
5
explain select * from t1 where not(not(a));
6
id select_type table type possible_keys key key_len ref rows Extra
7
1 SIMPLE t1 index NULL a 5 NULL 21 Using where; Using index
8
select * from t1 where not(not(a));
29
explain select * from t1 where not(not(not(a > 10)));
30
id select_type table type possible_keys key key_len ref rows Extra
31
1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index
32
select * from t1 where not(not(not(a > 10)));
45
explain select * from t1 where not(not(not(a < 5) and not(a > 10)));
46
id select_type table type possible_keys key key_len ref rows Extra
47
1 SIMPLE t1 range a a 5 NULL 5 Using where; Using index
48
select * from t1 where not(not(not(a < 5) and not(a > 10)));
56
explain select * from t1 where not(a = 10);
57
id select_type table type possible_keys key key_len ref rows Extra
58
1 SIMPLE t1 range a a 5 NULL 19 Using where; Using index
59
select * from t1 where not(a = 10);
80
explain select * from t1 where not(a != 10);
81
id select_type table type possible_keys key key_len ref rows Extra
82
1 SIMPLE t1 ref a a 5 const 1 Using index
83
select * from t1 where not(a != 1);
86
explain select * from t1 where not(a < 10);
87
id select_type table type possible_keys key key_len ref rows Extra
88
1 SIMPLE t1 range a a 5 NULL 11 Using where; Using index
89
select * from t1 where not(a < 10);
101
explain select * from t1 where not(a >= 10);
102
id select_type table type possible_keys key key_len ref rows Extra
103
1 SIMPLE t1 range a a 5 NULL 9 Using where; Using index
104
select * from t1 where not(a >= 10);
116
explain select * from t1 where not(a > 10);
117
id select_type table type possible_keys key key_len ref rows Extra
118
1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index
119
select * from t1 where not(a > 10);
132
explain select * from t1 where not(a <= 10);
133
id select_type table type possible_keys key key_len ref rows Extra
134
1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index
135
select * from t1 where not(a <= 10);
146
explain select * from t1 where not(a is null);
147
id select_type table type possible_keys key key_len ref rows Extra
148
1 SIMPLE t1 range a a 5 NULL 20 Using where; Using index
149
select * from t1 where not(a is null);
171
explain select * from t1 where not(a is not null);
172
id select_type table type possible_keys key key_len ref rows Extra
173
1 SIMPLE t1 ref a a 5 const 1 Using where; Using index
174
select * from t1 where not(a is not null);
177
explain select * from t1 where not(a < 5 or a > 15);
178
id select_type table type possible_keys key key_len ref rows Extra
179
1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index
180
select * from t1 where not(a < 5 or a > 15);
193
explain select * from t1 where not(a < 15 and a > 5);
194
id select_type table type possible_keys key key_len ref rows Extra
195
1 SIMPLE t1 range a a 5 NULL 12 Using where; Using index
196
select * from t1 where not(a < 15 and a > 5);
209
explain select * from t1 where a = 2 or not(a < 10);
210
id select_type table type possible_keys key key_len ref rows Extra
211
1 SIMPLE t1 range a a 5 NULL 12 Using where; Using index
212
select * from t1 where a = 2 or not(a < 10);
225
explain select * from t1 where a > 5 and not(a > 10);
226
id select_type table type possible_keys key key_len ref rows Extra
227
1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index
228
select * from t1 where a > 5 and not(a > 10);
235
explain select * from t1 where a > 5 xor a < 10;
236
id select_type table type possible_keys key key_len ref rows Extra
237
1 SIMPLE t1 index NULL a 5 NULL 21 Using where; Using index
238
select * from t1 where a > 5 xor a < 10;
256
explain select * from t1 where a = 2 or not(a < 5 or a > 15);
257
id select_type table type possible_keys key key_len ref rows Extra
258
1 SIMPLE t1 range a a 5 NULL 11 Using where; Using index
259
select * from t1 where a = 2 or not(a < 5 or a > 15);
273
explain select * from t1 where a = 7 or not(a < 15 and a > 5);
274
id select_type table type possible_keys key key_len ref rows Extra
275
1 SIMPLE t1 range a a 5 NULL 13 Using where; Using index
276
select * from t1 where a = 7 or not(a < 15 and a > 5);
290
explain select * from t1 where NULL or not(a < 15 and a > 5);
291
id select_type table type possible_keys key key_len ref rows Extra
292
1 SIMPLE t1 range a a 5 NULL 12 Using where; Using index
293
select * from t1 where NULL or not(a < 15 and a > 5);
306
explain select * from t1 where not(NULL and a > 5);
307
id select_type table type possible_keys key key_len ref rows Extra
308
1 SIMPLE t1 range a a 5 NULL 6 Using where; Using index
309
select * from t1 where not(NULL and a > 5);
317
explain select * from t1 where not(NULL or a);
318
id select_type table type possible_keys key key_len ref rows Extra
319
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
320
select * from t1 where not(NULL or a);
322
explain select * from t1 where not(NULL and a);
323
id select_type table type possible_keys key key_len ref rows Extra
324
1 SIMPLE t1 index NULL a 5 NULL 21 Using where; Using index
325
select * from t1 where not(NULL and a);
328
explain select * from t1 where not((a < 5 or a < 10) and (not(a > 16) or a > 17));
329
id select_type table type possible_keys key key_len ref rows Extra
330
1 SIMPLE t1 range a a 5 NULL 11 Using where; Using index
331
select * from t1 where not((a < 5 or a < 10) and (not(a > 16) or a > 17));
343
explain select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17));
344
id select_type table type possible_keys key key_len ref rows Extra
345
1 SIMPLE t1 range a a 5 NULL 15 Using where; Using index
346
select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17));
363
explain select * from t1 where ((a between 5 and 15) and (not(a like 10)));
364
id select_type table type possible_keys key key_len ref rows Extra
365
1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index
366
select * from t1 where ((a between 5 and 15) and (not(a like 10)));
378
delete from t1 where a > 3;
379
select a, not(not(a)) from t1;
386
explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "1"), not (a not in (1,2)), not(a != 2) from t1 where not(not(a)) having not(not(a));
387
id select_type table type possible_keys key key_len ref rows filtered Extra
388
1 SIMPLE t1 index NULL a 5 NULL 5 100.00 Using where; Using index
390
Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a` <> 0) AS `not(not(a))`,((`test`.`t1`.`a` > 2) or `test`.`t1`.`a`) AS `not(a <= 2 and not(a))`,(`test`.`t1`.`a` like '1') AS `not(a not like "1")`,(`test`.`t1`.`a` in (1,2)) AS `not (a not in (1,2))`,(`test`.`t1`.`a` = 2) AS `not(a != 2)` from `test`.`t1` where `test`.`t1`.`a` having `test`.`t1`.`a`