1.建库建表
create databases testhive;
create table student(id int,name string) row format delimited fields terminated by ",";
2.数据样本
2,Tiny
3,Fun
4,Mark
3.加载数据
load data local inpath "/opt/module/datas/student.txt" into table student; ---加载本地数据
load data inpath "/test.txt" into table test_student; ---加载hdfs数据到hive
内部表位置:warehouse
删除内部表:数据也删除
4.建外部表
create external table tt_student(id int,name string) row format delimited fields terminated by "," location '/test';
load data local inpath "/opt/module/datas/student.txt" into table student; ---加载本地数据
数据的位置:
5.删除外部表
文件还在