目录
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;