更新时间:2023-02-26 09:50:02
要获取所有表的名称,请使用:
To get the name of all tables use:
SELECT table_name FROM information_schema.tables;
要从特定数据库中获取表的名称,请使用:
To get the name of the tables from a specific database use:
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'your_database_name';
现在,要回答原始问题,请使用以下查询:
Now, to answer the original question, use this query:
INSERT INTO table_name
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'your_database_name';
更多详情参见:http://dev.mysql.com/doc/refman/5.0/en/information-schema.html