如何列出 MySQL 数据库中匹配关键字并以年份结尾的所有表?

How to list all tables in MySQL database which match a keyword and ended with year?

如何列出 MySQL 数据库中匹配 "bl_pelanggan"+YEAR 的所有表?

目前我使用以下查询:

SHOW TABLES LIKE 'bl_pelanggan%'

但它列出了所有这些:

我只想要红框里面,怎么办?

你可以这样试试,

SELECT table_name, table_type, ENGINE
       FROM information_schema.tables
       WHERE table_schema = 'your schema name' AND table_name REGEXP '[[:digit:]]$'AND table_name LIKE 'bl_pelanggan%'
       ORDER BY table_name;
SHOW TABLES FROM INFORMATION_SCHEMA 
WHERE Tables_in_information_schema LIKE 'bl_pelanggan201%'

你可以查看http://rextester.com/AOVZ31733

SHOW TABLES LIKE 'bl_pelanggan____'

这应该也是可以的:

show tables from <your_schema_name> where tables_in_<your_schema_name> like "bl_pelanggan201%";