RENAME TABLE tbl_name TO new_tbl_name [, tbl_name2 TO new_tbl_name2, ...]
CREATE TABLE new_table (...);
RENAME TABLE old_table TO backup_table, new_table TO old_table;
RENAME TABLE old_table TO backup_table,
new_table TO old_table,
backup_table TO new_table;
需引入暫存名稱,因順序執行特性。
RENAME TABLE current_db.tbl_name TO other_db.tbl_name;
LOCK TABLES)。ALTER、DROP 權限,新表 CREATE、INSERT 權限。多表重命名中若發生錯誤,MySQL 會對**所有已重命名的表執行反向重命名**,回滾至初始狀態。
RENAME TABLE 於 MySQL 3.23.23 引入。