Hive三種不一樣的數據導出的方式sql
(1)導出到本地文件系統oop
insert overwrite local directory '/home/hadoop/hbase_table_2' orm
select * from hbase_table_2;hadoop
(2)導出到HDFSit
insert overwrite directory '/data' table
select * from hbase_table_2;form
(3)導出到hive的另外一個表中 test
insert into table hive_student_test select
select id,name,sex,salary sql語句
from student;
在hive0.11.0版本中新引進了一個新的特性
hive> insert overwrite local directory '/root/student'
> row format delimited
> fields terminated by '\t'
> select * from student;
還能夠用hive的-e和-f參數來導出數據,其中-e表示後面直接帶雙引號的sql語句;而-f是接一個文件,文件的內容爲一個sql語句
hive -e "select * from student" >> /root/student11.txt
這個獲得的結果也是用\t分割的。也能夠用-f實現
hive -f /root/SQL.sql >> /root/student12.txt