doc-exports/docs/dws/dev/dws_06_0276.html
Lu, Huayi e6fa411af0 DWS DEV 830.201 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-05-16 07:24:04 +00:00

8.1 KiB

RENAME TABLE

Function

RENAME TABLE renames a specified table.

Precautions

RENAME TABLE has the same function as the following command:

1
ALTER TABLE table_name RENAME to new_table_name

Syntax

1
2
RENAME TABLE
{[schema.]table_name TO new_table_name} [, ...];

Parameters

  • schema

    Specifies the schema name.

  • table_name

    Specifies the name of the table to be modified.

  • new_table_name

    Specifies the new table name.

Examples

Create a column-store table and specify the storage format and compression mode:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
DROP TABLE IF EXISTS customer_address;
CREATE TABLE customer_address
(
    ca_address_sk       INTEGER                  NOT NULL   ,
    ca_address_id       CHARACTER(16)            NOT NULL   ,
    ca_street_number    CHARACTER(10)                       ,
    ca_street_name      CHARACTER varying(60)               ,
    ca_street_type      CHARACTER(15)                       ,
    ca_suite_number     CHARACTER(10)                    
)
WITH (ORIENTATION = COLUMN, COMPRESSION=HIGH,COLVERSION=2.0)
DISTRIBUTE BY HASH (ca_address_sk);

Rename a table:

1
RENAME TABLE customer_address TO new_customer_address;

Helpful Links

CREATE TABLE, ALTER TABLE, and DROP TABLE