欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Hive如何更改表的屬性

這篇文章主要為大家展示了“Hive如何更改表的屬性”,內(nèi)容簡(jiǎn)而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“Hive如何更改表的屬性”這篇文章吧。

成都創(chuàng)新互聯(lián)的客戶(hù)來(lái)自各行各業(yè),為了共同目標(biāo),我們?cè)诠ぷ魃厦芮信浜希瑥膭?chuàng)業(yè)型小企業(yè)到企事業(yè)單位,感謝他們對(duì)我們的要求,感謝他們從不同領(lǐng)域給我們帶來(lái)的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會(huì)用頭腦與智慧不斷的給客戶(hù)帶來(lái)驚喜。專(zhuān)業(yè)領(lǐng)域包括網(wǎng)站建設(shè)、網(wǎng)站制作、電商網(wǎng)站開(kāi)發(fā)、微信營(yíng)銷(xiāo)、系統(tǒng)平臺(tái)開(kāi)發(fā)。

1、修改表名
    alter table table_name rename to new_table_name;
    例1:alter table ruoze_emp rename to emp;
2、修改列名
    alter table tablename change column column_orign column_new int(修改后列的屬性) comment 'column_name'
    after severity;//可以把該列放到指定列的后面,或者使用‘first’放到第一位
    將表tablename中的列column_orign修改成column_new,同時(shí)指定修改后的列名稱(chēng)的屬性,comment是這個(gè)列的注釋
    例1:alter table emp change column age uage double comment 'column age' after id;
3、增加列
    alter table tablename add columns(column1 string comment 'xxxx',column2 long comment 'yyyy')
    例1:alter table emp add columns(age int);
4、替換表
    ALTER TABLE table_name [PARTITION partition_spec] ADD|REPLACE COLUMNS (col_name data_type [COMMENT col_comment], ...) [CASCADE|RESTRICT]                         -- (Note: Hive 1.1.0 and later)
    例1:ALTER TABLE emp REPLACE COLUMNS (age int, uage int);
5、查看表的屬性
    desc formatted tablename;
6、修改表的屬性
    (1)alter table table_name set tblproperties('property_name'='new_value');
       將table_name表中的comment屬性值修改成'new_value';
    (2)alter table emp set serdeproperties ("field.delim"="\t");
       將表table_name中的字段分割符修改成'\t',注意,這是在表沒(méi)有分區(qū)的情況下
    例1:create table emp(id int,uname string)row format delimited fields terminated by '#' lines terminated by '\n' stored as textfile;
       alter table emp set serdeproperties('field.delim'='\t');這條語(yǔ)句將t8表中的字段分隔符'#'修改成'\t';
    例2:create table emp(id int,uname string) partitioned by(dt=string) row foramt delimited fields terminated by '\n' stored as textfile;
       alter table emp partition(dt='20180108') set serdeproperties('field.delim=\t');
    (3)alter table table_name[partition] set location 'path'
       alter table emp set TBLPROPERTIES('EXTERNAL'='TRUE');//內(nèi)部表轉(zhuǎn)化成外部表
       alter table emp set TBLPROPERTIES('EXTERNAL'='FALSE');//外部表轉(zhuǎn)成內(nèi)部表

    注意:由于emp默認(rèn)是內(nèi)表,所以在刪除表emp時(shí),它的數(shù)據(jù)包括文件目錄全部被刪除,為了防止這種情況發(fā)生,可以將表emp修改成外表,
    通過(guò)語(yǔ)句:alter table emp set tblproperties('EXTERNAL'='TRUE');同樣也可以將外部表修改為內(nèi)部表,
    可以通過(guò)語(yǔ)句:alter table city set tblproperties('EXTERNAL'='FALSE');
    (4)其他修改表屬性的命令:
       alter table properties; alter serde properties;
       alter table/partition file format;
       alter table storage properties;
       alter table rename partition;
       alter table set location;

以上是“Hive如何更改表的屬性”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

網(wǎng)頁(yè)標(biāo)題:Hive如何更改表的屬性
文章分享:http://chinadenli.net/article46/jiechg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、企業(yè)建站網(wǎng)站改版、網(wǎng)站維護(hù)網(wǎng)站營(yíng)銷(xiāo)、虛擬主機(jī)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

綿陽(yáng)服務(wù)器托管