内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

Hive如何更改表的屬性

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

成都創(chuàng)新互聯(lián)的客戶來自各行各業(yè),為了共同目標(biāo),我們在工作上密切配合,從創(chuàng)業(yè)型小企業(yè)到企事業(yè)單位,感謝他們對(duì)我們的要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會(huì)用頭腦與智慧不斷的給客戶帶來驚喜。專業(yè)領(lǐng)域包括網(wǎng)站建設(shè)、網(wǎng)站制作、電商網(wǎng)站開發(fā)、微信營銷、系統(tǒng)平臺(tá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í)指定修改后的列名稱的屬性,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',注意,這是在表沒有分區(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');這條語句將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修改成外表,
    通過語句:alter table emp set tblproperties('EXTERNAL'='TRUE');同樣也可以將外部表修改為內(nèi)部表,
    可以通過語句: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)頁標(biāo)題:Hive如何更改表的屬性
文章分享:http://www.rwnh.cn/article46/jiechg.html

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

廣告

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

綿陽服務(wù)器托管
宝坻区| 乌鲁木齐市| 三都| 敖汉旗| 上饶市| 故城县| 宜良县| 阜城县| 宣城市| 息烽县| 固始县| 耒阳市| 英超| 惠州市| 南开区| 淳安县| 平南县| 康保县| 新蔡县| 讷河市| 扎囊县| 衡阳市| 石嘴山市| 荆门市| 陆河县| 南通市| 柳州市| 铜川市| 苏州市| 彩票| 柳江县| 吐鲁番市| 合川市| 安徽省| 基隆市| 乌拉特前旗| 文水县| 子长县| 灌阳县| 海原县| 邵东县|