hive增改刪字段

2021-10-09 01:29:10 字數 1318 閱讀 8237

(1)修改欄位名方法:

alter table 表名 change 舊欄位 新字段 型別;

(2)新增字段:use mart_flow_test;

alter table detail_flow_test add columns(original_union_id string);

或者:alter table 表名 add columns (列名 string comment 『department name』);

alter table detail_flow_test add columns (original_old string comment 『哈哈』)

(3)修改注釋:use original_union_id;

alter table detail_flow_test change column original_union_id original_union_id string comment 『原始裝置唯一性標識』;

(4)hive 新增表字段,給字段排序

alter table 表名 change column col_old_name col_new_name column_type [comment col_comment] after 列名(放在哪個欄位後);

例項:把original_union_id 放到 original_old 後面

alter table detail_flow_test change column original_union_id original_union_id string after original_old

(5) 重新命名分割槽

alter table table_name partition partition_spec rename to partition partition_spec; --這個是重新命名dt= 後面的內容

alter table detail_flow_test partition partition_date rename to partition dt ; —錯誤

alter table detail_flow_test change partition_date dt string

調整字段位置

alter table ifu_dw.dw_ap_ver_cash_zfk_kd_m add columns(cash_fee_zfk decimal(20,6) comment 『主副卡當月合計收入』);

alter table ifu_dw.dw_ap_ver_cash_zfk_kd_m change column cash_fee_zfk cash_fee_zfk decimal(20,6) after cash_fee_zfk_kd;

Hive表 增改刪字段

基本語法 alter table name rename to new name alter table name add columns col spec col spec alter table name drop column column name alter table name chan...

js的增改刪

insertbefore插入元素 語法 父元素.insertbefore 引數1,引數2 引數1 需要插入新的元素 引數2 插入到哪個元素的前面 1.建立新的元素 2.原本存在的元素 3.需要插入的元素 獲取元素 var ul document.getelementbyid ul var li2 d...

merge同時包含增 改 刪

我們都知道oracle merge可以用來增和改,很少用它來刪除。但是有時候我們仍然需要該特性,以提高效能,典型的場景就是將業務庫邏輯刪除的記錄同步到查詢庫的時候,做真正的物理刪除,這個時候merge的delete子句就再恰當不過了。如下所示 merge into ausing employee b...