---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://ydb.tech/docs/en/yql/reference/syntax/alter_table/rename.md?version=v25.4
  - https://ydb.tech/docs/ru/yql/reference/syntax/alter_table/rename.md?version=v25.4
  - href: en/yql/reference/syntax/alter_table/rename.md
    type: text/markdown
    title: Markdown version
  - href: ../../../../llms.txt
    type: text/markdown
    title: llms.txt
sourcePath: en/core/yql/reference/syntax/alter_table/rename.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ydb.tech/docs/en/llms.txt

# Renaming a table

```yql
ALTER TABLE old_table_name RENAME TO new_table_name;
```


{% note info %}

When choosing a name for the table, consider the common [schema object naming rules](https://ydb.tech/docs/en/concepts/datamodel/cluster-namespace.md?version=v25.4#object-naming-rules).

{% endnote %}


If a table with the new name already exists, an error will be returned. The ability to transactionally replace a table under load is supported by specialized methods in CLI and SDK.

{% note warning %}

If a YQL query contains multiple `ALTER TABLE ... RENAME TO ...` commands, each will be executed in auto-commit mode in a separate transaction. From the perspective of an external process, the tables will be renamed sequentially, one after another. To rename multiple tables in a single transaction, use specialized methods available in CLI and SDK.

{% endnote %}

Renaming can be used to move a table from one directory within the database to another, for example:

``` yql
ALTER TABLE `table1` RENAME TO `/backup/table1`;
```
