Skip to main content

RENAME TABLE

Changes the name of a table.

Syntax

ALTER TABLE [ IF EXISTS ] <name> RENAME TO <new_table_name>

Examples

mysql>
create table test(a int);
mysql>
show tables;
+------+
| name |
+------+
| test |
+------+
mysql>
alter table `test` rename to `new_test`;
mysql>
show tables;
+----------+
| name |
+----------+
| new_test |
+----------+