mysql重命名一个表

来源:互联网 发布:关系数据库教程 编辑:程序博客网 时间:2024/06/05 18:59

使用rename table

rename table table1_altered to table;

这里的sql语句会将table1_altered 重命名为table

rename语句还可以将表移到另一个数据库中

rename table rookery.birds to rookery.birds_old,test.birds_new to rookery.birds;

这里的sql语句可以将rookery数据库的birds表改名为bird_old表,第二句将test数据库的birds_new表移到rookery数据库中的birds表