VeloDB Cloud
SQL Manual
Statments
Data-Definition-Statements
Alter
ALTER-TABLE-RENAME

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.

Syntax:

ALTER TABLE [database.]table alter_clause;

The alter_clause of rename supports modification of the following names

  1. Modify the table name

Syntax:

RENAME new_table_name;
  1. Modify the rollup index name

Syntax:

RENAME ROLLUP old_rollup_name new_rollup_name;
  1. Modify the partition name

Syntax:

RENAME PARTITION old_partition_name new_partition_name;
  1. Modify the column name

Syntax:

RENAME COLUMN old_column_name new_column_name;

Note:

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

Example

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

Keywords

ALTER, TABLE, RENAME, ALTER TABLE

Best Practice