以下示例均是在hive中进行操作
创建表 t1:
create table a(id int,name string)
row format delimited
fields terminated by ',';
构造数据:
1,zs
2,ls
3,ww
加载数据到表t1:
load data local inpath '/root/a.dat' into table a;
创建表 t2:
create table b(id int,nickname string)
row format delimited
fields terminated by ',';
构造数据:
1,zzz
3,www
4,sss
将数据加载到表t2:
load data local inpath '/root/b.dat' into table b;
--两表的数据:
0: jdbc:hive2://cts03:10000> select * from a;
+-------+---------+--+
| a.id | a.name |
+-------+---------+--+
| 1 | zs |
| 2 | ls |
| 3 | ww |
+-------+---------+--+
0: jdbc:hive2:/