RENAME TABLE
Description
Renames one or more tables. The renaming does not affect stored data.
Syntax
RENAME { TABLE | TABLES } table_name TO new_table_name [, table_name2 TO new_table_name2, ...];
Parameters
- TABLE | TABLES
TABLE and TABLES can be used interchangeably, regardless of the number of tables operated in the statement.
- table_name TO new_table_name [, table_name2 TO new_table_name2, ...]
table_name and table_name2...: specify the table names to be modified.
new_table_name and new_table_name2...: specify the new table names.
TO: specifies a connection word, which has no actual meaning.
Examples of Modifying Tables
- Rename a single table.
gaussdb=# CREATE TABLE aa(c1 int, c2 int); gaussdb=# RENAME TABLE aa TO test_alt1; gaussdb=# DROP TABLE test_alt1;
- Rename multiple tables.
gaussdb=# CREATE TABLE aa(c1 int, c2 int); gaussdb=# CREATE TABLE bb(c1 int, c2 int); gaussdb=# RENAME TABLE aa TO test_alt1, bb TO test_alt2; gaussdb=# DROP TABLE test_alt1,test_alt2;
Helpful Links
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot