创建表时加载
create table newtable as select col1,col2 from oldtable;
创建表时指定数据位置
create table tablename() location ''
root@ubuntu:~# cat student1.txt
xiaoming 10
xiaohong 12
xiaoli 13
xiaowang 11
root@ubuntu:~# hadoop fs -mkdir /user/hive/warehouse/data
root@ubuntu:~# hadoop fs -put student1.txt /user/hive/warehouse/data/
hive> create table student2(name string,age int) row format delimited fields terminated by '\t' lines terminated by '\n' stored as textfile location '/user/hive/warehouse/data/';
OK
Time taken: 0.272 seconds
hive> select * from student2;
OK
xiaoming 10
xiaohong 12
xiaoli 13
xiaowang