繁体   English   中英

Mysql 将所有表以不同的名称复制到同一个数据库中,例如 (tablename_log)

[英]Mysql copy all tables into the same database with different name like (tablename_log)

我有一个包含大约 100 个表的数据库,我需要创建日志表作为每个现有表的副本并附加_log ,手动执行此操作非常耗时,有没有办法通过程序或任何其他方法来执行此操作解决方案?

例子:

attachments

students

...

需要它们的副本,如下所示:

attachments_log

students_log

...

select concat('create table ',table_name, '_log like ' , table_name, ';') from information_schema.tables where table_schema = 'schemaname';

在记事本中整理 - 工作完成(无论如何)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM