alter table table_name add columns(col_name string comment '字段说明') ;alter table table_name change col_name col_name string comment'字段说明' after col_name_2;
create table test.dwd_tb_user(id bigint comment'自增主键', user_id string comment'用户id', user_name string comment'用户姓名', create_time string comment '创建日期', update_time string comment '修改日期') comment'用户信息表'stored as parquet
TBLPROPERTIES('parquet.compression'='SNAPPY');
desc test.dwd_tb_user
alter table test.dwd_tb_user add columns(phone string comment '手机号码') ;
desc test.dwd_tb_user
alter table test.dwd_tb_user change phone phone string comment'手机号码' after user_name;
desc test.dwd_tb_user
ALTER TABLE table_name
[PARTITION partition_spec]ADD|REPLACE COLUMNS (col_name data_type [COMMENT col_comment], ...)
[CASCADE|RESTRICT]
ALTER TABLE ADD or REPLACE COLUMNS CASCADE will override the table partition’s column metadata regardless of the table or partition’s protection mode. Use with discretion.
ALTER TABLE table_name CHANGE [COLUMN] col_old_name col_new_name column_type [COMMENT col_comment] [FIRST|AFTER column_name]
联系客服