1. 添加主键
ALTER TABLE public.tablename -- 添加主键的表名 ADD CONSTRAINT tablename_pkey -- 主键的名称 PRIMARY KEY (id -- 主键的列名 );
2、删除主键
alter table dw_stg.stg_ord_fct_quote_items_info_mid drop CONSTRAINT stg_ord_fct_quote_items_info_mid_pkey;
3、更改分布键
alter table dw_stg.stg_ord_fct_quote_items_info_mid set distributed by(quote_item_id,ord_loc);
4、新增主键
alter table dw_stg.stg_ord_fct_quote_items_info_mid add CONSTRAINT stg_ord_fct_quote_items_info_mid_pkey primary key(quote_item_id,ord_loc);









