create or replace table t (a int, key(a asc)) engine=innodb;
|
insert into t select seq * 2 from seq_1_to_100 order by rand(1);
|
explain select max(200 - a) from t;
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
| 1 | SIMPLE | t | index | NULL | a | 5 | NULL | 100 | Using index |
|
select max(200 - a) from t;
|
max(200 - a)
|
198
|
explain select min(200 - a) from t;
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
| 1 | SIMPLE | t | index | NULL | a | 5 | NULL | 100 | Using index |
|
select min(200 - a) from t;
|
min(200 - a)
|
0
|