1
mysql> drop table if exists t1, t2;
2
Query OK, 0 rows affected (0.00 sec)
4
mysql> create table t1 (a1 int, a2 char(3), key k1(a1), key k2(a2));
5
Query OK, 0 rows affected (0.05 sec)
7
mysql> insert into t1 values(10,'aaa'), (10,null), (10,'bbb'), (20,'zzz');
8
Query OK, 4 rows affected (0.00 sec)
9
Records: 4 Duplicates: 0 Warnings: 0
11
mysql> create table t2(a1 char(3), a2 int, a3 real, key k1(a1), key k2(a2, a1));
12
Query OK, 0 rows affected (0.04 sec)
14
mysql> explain select max(t1.a1), max(t2.a2) from t1, t2;
15
+----+-------------+-------+------+---------------+------+---------+------+------+-------------------------+
16
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
17
+----+-------------+-------+------+---------------+------+---------+------+------+-------------------------+
18
| 1 | SIMPLE | NULL | NULL | NULL | NULL | NULL | NULL | NULL | No matching min/max row |
19
+----+-------------+-------+------+---------------+------+---------+------+------+-------------------------+
20
1 row in set (0.00 sec)
22
mysql> drop table if exists t1, t2;
23
Query OK, 0 rows affected (0.00 sec)