跳到主要内容

RENAME TABLE

Changes the name of a table.

Syntax

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

Examples

CREATE TABLE test(a INT);
SHOW TABLES;
+------+
| name |
+------+
| test |
+------+
ALTER TABLE `test` RENAME TO `new_test`;
SHOW TABLES;
+----------+
| name |
+----------+
| new_test |
+----------+