create table old_table(id int);
create table new_table like old_table;
RENAME TABLE old_table TO backup_table, new_table TO old_table;
本文介绍了一种通过创建新表并重命名来调整数据库表结构的方法。首先创建一个与原表结构相同的新表,然后将原表重命名为备份表,并将新表命名为原表名。
create table old_table(id int);
create table new_table like old_table;
RENAME TABLE old_table TO backup_table, new_table TO old_table;
6414
2086
2702
4507

被折叠的 条评论
为什么被折叠?