ClickHouse/docs/zh/sql-reference/statements/exchange.md

43 lines
799 B
Markdown
Raw Normal View History

2021-08-27 11:32:21 +00:00
---
toc_priority: 49
toc_title: EXCHANGE
---
# EXCHANGE语法 {#exchange}
以原子方式交换两个表或字典的名称。
此任务也可以通过使用[RENAME](./rename.md)来完成,但在这种情况下操作不是原子的。
!!! note "注意"
`EXCHANGE`仅支持[Atomic](../../engines/database-engines/atomic.md)数据库引擎.
**语法**
```sql
EXCHANGE TABLES|DICTIONARIES [db0.]name_A AND [db1.]name_B
```
## EXCHANGE TABLES {#exchange_tables}
交换两个表的名称。
**语法**
```sql
EXCHANGE TABLES [db0.]table_A AND [db1.]table_B
```
## EXCHANGE DICTIONARIES {#exchange_dictionaries}
交换两个字典的名称。
**语法**
```sql
EXCHANGE DICTIONARIES [db0.]dict_A AND [db1.]dict_B
```
**参考**
- [Dictionaries](../../sql-reference/dictionaries/index.md)