title | summary | aliases | ||
---|---|---|---|---|
RENAME TABLE |
TiDB 数据库中 RENAME TABLE 的使用概况。 |
|
RENAME TABLE
语句用于对已有表进行重命名。
RenameTableStmt ::=
'RENAME' 'TABLE' TableToTable ( ',' TableToTable )*
TableToTable ::=
TableName 'TO' TableName
{{< copyable "sql" >}}
CREATE TABLE t1 (a int);
Query OK, 0 rows affected (0.12 sec)
{{< copyable "sql" >}}
SHOW TABLES;
+----------------+
| Tables_in_test |
+----------------+
| t1 |
+----------------+
1 row in set (0.00 sec)
{{< copyable "sql" >}}
RENAME TABLE t1 TO t2;
Query OK, 0 rows affected (0.08 sec)
{{< copyable "sql" >}}
SHOW TABLES;
+----------------+
| Tables_in_test |
+----------------+
| t2 |
+----------------+
1 row in set (0.00 sec)
RENAME TABLE
语句与 MySQL 完全兼容。如发现任何兼容性差异,请尝试 TiDB 支持资源。