在这篇文章里,我们创建一张clickhouse表,并对数据进行增删改查

创建一张表

create table test_ddl1(
	id UInt16,
	name String
)
engine = MergeTree()
order by id;

增加数据,我们从csv文件导入

clickhouse-client --format_csv_delimiter=',' \
-nq 'use doit20; insert into test_ddl1 FORMAT CSV' < ./tb_partition.txt

删除数据,mutation操作

alter table test_ddl1 delete where id = 4;

修改数据,mutation操作

alter table test_ddl1 update name = '猴子' where id = 1;

查询数据

clickhouse-client -nq "use doit20; select * from test_ddl1;"

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐