clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 1228811 fiddles created (16680 in the last week).

select version();
version()
8.0.13
 hidden batch(es)


CREATE TABLE t1 (a TINYINT NOT NULL, KEY(a));
 hidden batch(es)


CREATE TABLE t2 (a TINYINT, KEY(a));
 hidden batch(es)


SHOW CREATE TABLE t1
Table Create Table
t1 CREATE TABLE `t1` ( `a` tinyint(4) NOT NULL, KEY `a` (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
 hidden batch(es)


SHOW CREATE TABLE t2
Table Create Table
t2 CREATE TABLE `t2` ( `a` tinyint(4) DEFAULT NULL, KEY `a` (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
 hidden batch(es)


INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
 hidden batch(es)


INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
 hidden batch(es)


EXPLAIN SELECT * FROM t1 WHERE a!=a;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE Impossible WHERE
 hidden batch(es)


EXPLAIN SELECT * FROM t2 WHERE a!=a;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index a 2 5 80.00 Using where; Using index
 hidden batch(es)


EXPLAIN SELECT * FROM t1 WHERE a<a;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE Impossible WHERE
 hidden batch(es)


EXPLAIN SELECT * FROM t2 WHERE a<a;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index a 2 5 33.33 Using where; Using index
 hidden batch(es)


EXPLAIN SELECT * FROM t1 WHERE a>a;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE Impossible WHERE
 hidden batch(es)


EXPLAIN SELECT * FROM t2 WHERE a>a;
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index a 2 5 33.33 Using where; Using index
 hidden batch(es)


EXPLAIN SELECT COUNT(*) FROM t1 WHERE not (a!=a);
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index a 1 5 100.00 Using index
 hidden batch(es)


EXPLAIN SELECT COUNT(*) FROM t2 WHERE not (a!=a);
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index a 2 5 20.00 Using where; Using index
 hidden batch(es)