



全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Hive常用命令:1、 查看数据库 show databases; /查看已经存在的数据库 describe database test; /查看某个已经存在的数据库2、创建数据库 create database test; create database if not exists test; create database test2 location /user/hadoop/temp; /制定数据库创建的目录3、 删除数据库 drop database if exists test1 cascade;4、切换当前工作的数据库 use test2;5、 查看数据库中的表 show tables; /查看当前工作的数据库中的表 show tables in test3; /查看数据库test3中的表6、 创建表 create table if not exists test.student( name string comment student name, age int comment student age, course array, body map, address struct ) comment the info of student /表的备注 row format delimited fields terminated by 001 /指定列分隔符001 collection items terminated by 002 /指定集合元素间的分隔符002 map keys terminated by 003 /指定类型为MAP字段的键值对分割符 lines terminated by n /指定行分割符 stored as textfile /存储的文件格式 location /user/hive/warehouse/test.db/student; create table if not exists student2 like student; /复制已存在的表结构创建表(不复制数据) Hive中建表默认为管理表(managed table),当表需要被其它工具分析时,需要建立外部表(exter nal table) create exter nal table - /建立外部表 建立分区表 create table student_info( id string, name string, age int) partitioned by (province string,city string); 7、 查看表结构信息以及列的注释 desc student;8、查看表的详细信息 desc formatted student;9、 查看分区表的详细信息 describe extended student_info;10、 删除表 drop table student; drop table if exists student;11、 表重命名alter table student rename to student_1;12、 增加、修改、删除分区 alter table student_info add partition (province=fujain,city=fuzhou) location /user/hive/warehouse/test/fujian/fuzhou; /表必须为分区表,且province、city为分区字段 alter table student_info drop partition(province=fujian,city=fuzhou);13、 修改列信息 alter table student_1 change column age sage int comment
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 房地产教育活动
- 传统媒体发展报告
- 房屋安全教育
- 江西省共青城市中考数学能力提升B卷题库【含答案详解】
- 电机基础知识培训计划课件
- 耐格门窗专业知识培训课程课件
- 陕西省咸阳市2023-2024学年高一下学期7月期末地理试题(解析版)
- 陕西省多校联考2024-2025学年高一下学期4月期中地理试题(解析版)
- 羽绒服修复专业知识培训课件
- 江苏省苏州高新区一中2026届化学高三第一学期期中教学质量检测试题含解析
- 质押合同解除通知函
- 云计算技术的分布式计算技术
- (高清版)TDT 1075-2023 光伏发电站工程项目用地控制指标
- 中国古代十大传世名画
- 2024年全国初中数学联赛试题及答案(修正版)
- 物业保安、保洁项目投标书
- CityEngine城市三维建模入门教程 课件全套 第1-7章 CityEngine概述-使用Python脚本语言
- 通信电源通信电源的概念
- 2022智慧建筑评价标准
- 科技论文写作2-科研论文的基本格式与规范
- 《危险化学品目录(2022调整版)》
评论
0/150
提交评论