标签:into 导出 导入 user student table 数据 overwrite
1.从外部文件系统向表中加载数据 load [overwrite] into
load data [local] inpath "" [overwrite] into table table_name [partition(col_name="")]
local:表示从本地加载数据到HIVE表,否则从HDFS加载
overwrite:表示覆盖表中已有数据,否则表示追加
(1)从本地上传数据到表格 load data local inpath "/opt/module/datas/student.txt" into table kg_risk_student; (2)从hdfs上传数据到表格 load data inpath "/student.txt" into table kg_risk_student;
2.通过查询语句向表中插入数据 insert overwrite/into
(1)基本插入数据 overwrite/into insert overwrite/into table bigdata17-user_parttion partition(userid=1) values("zhang","zhangshan"); (2)根据查询结果插入语句 insert overwrite/into table bigdata17-user_parttion partition(userid=1) select username ,fullname from bigdata17_user;
3.查询语句直接创建并加载数据 as
create table if not exists student2 as select * from student;
4.创建表时通过Location指定加载数据路径
(1)创建表,并指定hdfs路径 drop table if exists student; create table if not exists student( id int, name string, gender string) row format delimited fields terminated by "," lacation "/user/hive/warehouse/student" ; (2)数据上传到hdfs dfs -put /opt/module/datas/student.txt /user/hive/warehouse/student (3)查询数据 select * from student
5.import 导入到HIVE
import table student from "/user/hive/warehouse/export/student"
标签:into,导出,导入,user,student,table,数据,overwrite 来源: https://www.cnblogs.com/hapyygril/p/14089846.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。