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 | +----------+

Was this page helpful?