解决方案是:
show tables where tables_in_$DB not like 'a%';
以下是一些演示:
mysql> show tables;
+-----------------+
| Tables_in_test3 |
+-----------------+
| a1 |
| t1 |
| t2 |
+-----------------+
3 rows in set (0.00 sec)
-- LIKE is simpler than NOT LIKE
mysql> show tables like 'a%';
+----------------------+
| Tables_in_test3 (a%) |
+----------------------+
| a1 |
+----------------------+
1 row in set (0.00 sec)
-- `show tables not like 'a%'` is not working,
-- use the following way for NOT LIKE matching
mysql> show tables where tables_in_test3 not like 'a%';
+-----------------+
| Tables_in_test3 |
+-----------------+
| t1 |
| t2 |
+-----------------+
2 rows in set (0.01 sec)