1. hive分區表中新增字段
alter table table_name add columns (column_new_name column_new_type [comment 'comment']); -- 實例 alter table db.own_cust add columns (login_cnt int comment '登錄次數', logintime string comment '登錄時間');
2. hive中修改字段名、字段類型、字段順序
# hive中,只能先新增字段后,再進行排序操作。
ALTER TABLE table_name [PARTITION partition_spec] CHANGE [COLUMN] col_old_name col_new_name column_type [COMMENT col_comment] [FIRST|AFTER column_name] [CASCADE|RESTRICT]; -- 實例1(修改列名)