hive 加载数据,
##方式一 create + loadcreate [external] table table_name(col1_name col1_type,...coln_name coln_type)row format delimited fields terminated by '\t';//load加载数据load data [local] inpth '本地文件(linux)/HDFS' [overwrite] into table table_name;
##方式二 like + load##复制表结构create table tableB like tableA; //首先必须要有tableA
//load加载数据load data [local] inpth '本地文件(linux)/HDFS' [overwrite] into table table_name;
##方式三 as 创建表的同时加载数据create table tableB row format delimited filelds termianted by ','as select * from tableA; //首先必须要有tableA
create table emp_as row format delimited fields terminated by ',' as select empno,empname,salary from emp_part1;
*** ##方式四 create + insert1.创建表create table emp_insert(id int,name string,job string,salary float)row format delimited fields terminated by ',';
2.insert into 加载数据insert into table emp_insert select empno,empname,empjob,salary from emp_part1 where day='20170308' and hour='14';overwrite/into 二者不能连着写 要么是overwrite 要么是into,推荐用overwrite
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。