You need to enable JavaScript to run this app.
ByteHouse Cloud Data Warehouse Version

ByteHouse Cloud Data Warehouse Version

Copy page
Download PDF
DDL
Rename statement (RENAME)
Copy page
Download PDF
Rename statement (RENAME)

Rename a database, table, or dictionary. Multiple entities can be renamed in a single query.

tip

Please note that a RENAME query with multiple entities is a non-atomic operation.
:::

RENAME DATABASE

Rename a database.
Syntax

RENAME DATABASE atomic_database1 TO atomic_database2 [,...]

RENAME TABLE

Rename one or more tables.
Renaming a table is a lightweight operation. If a different database is specified after TO, the table will be moved to that database.** However, the directory containing the database must be located on the same file system. Otherwise, an error is returned. If multiple tables are renamed in a single query, the operation is not atomic. **The operation may be partially executed, and other sessions may receive Table ... does not exist ... errors.
Syntax

RENAME TABLE [tableIdentifier] TO [tableIdentifier], [tableIdentifier] TO [tableIdentifier]

Example

-- step 1: create a table 
CREATE TABLE `example_table` 
( 
    `a` Int8, 
    `b` String, 
    `c` Date 
) 
ENGINE = `CnchMergeTree` 
ORDER BY (`a`) 

-- step 2: rename the new created table 
RENAME TABLE example_table to new_table_name

RENAME DICTIONARY

Rename one or more dictionaries. This query can be used to move dictionaries between databases.
Syntax

RENAME DICTIONARY [db0.]dict_A TO [db1.]dict_B [,...]
Last updated: 2026.03.31 10:31:07