ALTER-TABLE-RENAME

Name

ALTER TABLE RENAME

Description

This statement is used to rename certain names of existing table properties. This operation is synchronous, and the return of the command indicates the completion of the execution.

grammar:

  1. ALTER TABLE [database.]table alter_clause;

The alter_clause of rename supports modification of the following names

  1. Modify the table name

grammar:

  1. RENAME new_table_name;
  1. Modify the rollup index name

    grammar:

  1. RENAME ROLLUP old_rollup_name new_rollup_name;
  1. Modify the partition name

grammar:

  1. RENAME PARTITION old_partition_name new_partition_name;
  1. Modify the column name

SinceVersion 1.2

Modify the column name

grammar:

  1. RENAME COLUMN old_column_name new_column_name;

Notice:

  • Currently only tables with column unique id are supported, which are created with property ‘light_schema_change’.

Example

  1. Modify the table named table1 to table2
  1. ALTER TABLE table1 RENAME table2;
  1. Modify the rollup index named rollup1 in the table example_table to rollup2
  1. ALTER TABLE example_table RENAME ROLLUP rollup1 rollup2;
  1. Modify the partition named p1 in the table example_table to p2
  1. ALTER TABLE example_table RENAME PARTITION p1 p2;
  1. Modify the column named c1 in the table example_table to c2
  1. ALTER TABLE example_table RENAME COLUMN c1 c2;

Keywords

  1. ALTER, TABLE, RENAME, ALTER TABLE

Best Practice