-
刪除數據
ALTER TABLE [db.]table DELETE WHERE filter_expr
-
更新數據
ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr
注意:
1. 這兩條命令必須在版本號大於1.1.54388纔可以使用,適用於 mergeTree 引擎
2. 這兩條命令是異步執行的,可以通過查看錶 system.mutations 來查看命令的是否執行完畢
select * from system.mutations where table='test_update';
Row 1:
──────
database: test
table: test_update
mutation_id: mutation_162.txt
command: UPDATE event_status_key = 0 WHERE event_status_key = 22
create_time: 2018-10-12 12:39:32
block_numbers.partition_id: ['']
block_numbers.number: [162]
parts_to_do: 0
is_done: 1
3.不可以用於分佈式表,需要在每臺機器上的local表中來執行
參考:https://clickhouse.yandex/docs/en/query_language/alter/