MySQL修改表名示例

首先,我们新建一个名为test_table的表:

drop table if exists test_table;
create table test_table select TABLE_SCHEMA,TABLE_NAME from information_schema.tables where TABLE_SCHEMA='information_schema';

然后,我们执行如下语句,将test_table改名为test_table_renamed

alter table test_table rename to test_table_renamed;

接下来我们执行如下语句看当前database下的所有表:

show tables;

发现test_table已经改名为test_table_renamed了。

posted @ 2019-01-03 17:20  zifeiy  阅读(409)  评论(0编辑  收藏  举报