RENAME TABLE
Change the name of one or more tables atomically. This command moves tables within or between databases while preserving their data and structure.
Syntax
RENAME TABLE[S] [IF EXISTS] tbl_name
[WAIT n | NOWAIT]
TO new_tbl_name
[, tbl_name2 TO new_tbl_name2] ...Description
IF EXISTS
CREATE TABLE new_table (...);
RENAME TABLE old_table TO backup_table, new_table TO old_table;Moving Tables to Another Database
RENAME TABLE db1.t TO db2.t;Limitations of Moving Tables to Another Database
Renaming Multiple Tables at Once
WAIT/NOWAIT
Privileges
Atomic RENAME TABLE
Last updated
Was this helpful?

