Hive常用命令

Hive常用命令

ID:41402391

大小:73.00 KB

页数:4页

时间:2019-08-24

Hive常用命令_第1页
Hive常用命令_第2页
Hive常用命令_第3页
Hive常用命令_第4页
资源描述:

《Hive常用命令》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、Hive常用命令:1、查看数据库showdatabases;//查看已经存在的数据库describedatabasetest;//查看某个已经存在的数据库2、创建数据库createdatabasetest;createdatabaseifnotexiststest;createdatabasetest2location'/user/hadoop/temp';//制定数据库创建的目录3、删除数据库dropdatabaseifexiststest1cascade;4、切换当前工作的数据库usetest2;5、查看数据库中的表s

2、howtables;//查看当前工作的数据库中的表showtablesintest3;//查看数据库test3中的表6、创建表createtableifnotexiststest.student(namestringcomment'studentname',ageintcomment'studentage',coursearray,bodymap,addressstruct)comment'thein

3、foofstudent'//表的备注rowformatdelimitedfieldsterminatedby'01'//指定列分隔符’01’collectionitemsterminatedby'02'//指定集合元素间的分隔符’02’mapkeysterminatedby'03'//指定类型为MAP字段的键值对分割符linesterminatedby''//指定行分割符storedastextfile//存储的文件格式location'/user/hive/warehouse/test.db/st

4、udent';createtableifnotexistsstudent2likestudent;//复制已存在的表结构创建表(不复制数据)Hive中建表默认为管理表(managedtable),当表需要被其它工具分析时,需要建立外部表(externaltable)createexternaltable--//建立外部表建立分区表createtablestudent_info(idstring,namestring,ageint)partitionedby(provincestring,citystring);5、查看表结

5、构信息以及列的注释descstudent;8、查看表的详细信息descformattedstudent;9、查看分区表的详细信息describeextendedstudent_info;10、删除表droptablestudent;droptableifexistsstudent;11、表重命名altertablestudentrenametostudent_1;12、增加、修改、删除分区altertablestudent_infoaddpartition(province='fujain',city='fuzhou')l

6、ocation'/user/hive/warehouse/test/fujian/fuzhou';//表必须为分区表,且province、city为分区字段altertablestudent_infodroppartition(province='fujian',city='fuzhou');13、修改列信息altertablestudent_1changecolumnagesageintcomment'thestudentage'aftername;9、增加列altertablestudent_1addcolumns(n

7、ew_colint);

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。