clickhouse - 第三章:内置对象 之 第二节:table表操作 - 行与列增删改查

目录

1.新增列

2.删除列

3.修改列类型


1.新增列

ALTER TABLE test.table_nmae ON CLUSTER cluster_name 
ADD COLUMN column_name1, ADD COLUMN column_name2;

-- 置于首列
alter table test.amz_fba_return add column channel_id UInt16 first;
-- 常规
alter table test.amz_fba_return add column fba_fee Float64;
-- 置于某列之后
alter table test.amz_fba_return add column address_type Nullable(String) after uds_load_date; 
-- 同时新增多列
alter table test.amz_fba_return add column storage_fee Float64 , add column address_note Nullable(String) ;

2.删除列

ALTER TABLE test.table_name ON CLUSTER cluster_name DROP COLUMN column_name1, DROP COLUMN column_name2;

-- 删除1列
alter table test.amz_fba_return drop column fba_fee;
-- 删除多列
alter table test.amz_fba_return drop column address_type , drop column address_note;

3.修改列类型

alter table test.amz_fba_return [ON CLUSTER cluster_name] 
modify column channel_id Int(32);

4.修改列名称

ALTER TABLE db.tablename [ON CLUSTER cluster] RENAME COLUMN name1 TO name2;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值