数据加载
(1)加载本地数据到hive表中
load data local inpath '/path' overwrite into table table_name;
(2)加载hdfs数据到hive表中
load data inpath '/path' overwrite into table table_name;
(3)创建表的时候加载数据
create table IF NOT EXISTS bhive.student
AS select id, name from bhive.people;
(4)通过select加载
insert into table table_name1 select * from table_name2;
(5)创建表的时候通过location指定的数据目录下已经有数据,会自动进行数据的加载。
数据的导出
(1)方式一:
insert overwrite [local] directory '/path'
row format delimited fields terminated by '\t' collection items terminated by '\n'
select * from table_name;
(2)方式二
bin/hive -e "select * from table_name;" > /path