hive詳細表結構操作(增加列,刪除列,修改列,移動列)

hive詳細表結構操作(增加列,刪除列,修改列,移動列)

hive修改表名

ALTER TABLE table_name RENAME TO new_table_name;

hive表在最後增加一個字段(在分區字段之前)

alter table table_name add columns (now_time string comment '當前時間');

hive表字段調整位置(在某個特定的位置添加字段)
hive表在某個特定的位置添加一個字段,在操作上是先在表的最後添加一個字段然後再將該字段移動到那個特定的位置

alter table table_name change now_time now_time string after id;

hive表修改列名(修改表字段類型)

ALTER TABLE table_name CHANGE name ename String;

hive表刪除列
假設一張student表,有id int,name string兩個字段,現在要刪除id字段

alter table student replace columns(name string);

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章