TABLE RENAME
Function
This command is used to rename an existing table.
Syntax
ALTER TABLE [db_name.]table_name RENAME TO new_table_name;
Parameter Description
| Parameter | Description |
|---|---|
| db_name | Database name. If this parameter is not specified, the current database is selected. |
| table_name | Current name of the existing table |
| new_table_name | New name of the existing table |
Precautions
- Parallel queries (using table names to obtain paths for reading CarbonData storage files) may fail during this operation.
- The secondary index table cannot be renamed.
Example
ALTER TABLE carbon RENAME TO carbondata;
ALTER TABLE test_db.carbon RENAME TO test_db.carbondata;
System Response
The new table name will be displayed in the CarbonData folder. You can run SHOW TABLES to view the new table name.
Last Article: ALTER TABLE COMPACTION
Next Article: ADD COLUMNS
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.