TiDBTiDB Docs Dash 2024

Jan 9 - Jan 12 (UTC)
Join us to improve docs and win a prize!
Sign InTry Free

RENAME TABLE

This statement renames an existing table to a new name.

Synopsis

RenameTableStmt
RENAMETABLETableToTable,
TableToTable
TableNameTOTableName

Examples

mysql> CREATE TABLE t1 (a int); Query OK, 0 rows affected (0.12 sec) mysql> SHOW TABLES; +----------------+ | Tables_in_test | +----------------+ | t1 | +----------------+ 1 row in set (0.00 sec) mysql> RENAME TABLE t1 TO t2; Query OK, 0 rows affected (0.08 sec) mysql> SHOW TABLES; +----------------+ | Tables_in_test | +----------------+ | t2 | +----------------+ 1 row in set (0.00 sec)

MySQL compatibility

The RENAME TABLE statement in TiDB is fully compatible with MySQL. If you find any compatibility differences, report a bug.

See also

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.