[01].加载学生表
启动
hivecd apache-hive-2.3.9-bin/bin
cd apache-hive-2.3.9-bin/bin

使用默认数据库
hive> use default;OKTime taken: 7.218 seconds
查看表
hive> show tables;OKstudentTime taken: 0.249 seconds, Fetched: 1 row(s)
创建表格(使用制表符分割)
hive> create table stu(id string,name string,stature int)row format delimited fields terminated by '\t';OKTime taken: 1.049 seconds
将清洗过的数据加载入表中
hive> load data inpath 'hdfs://master:8020/hiveoutput/part-r-00000' overwrite into table stu;Loading data to table default.studentOKTime taken: 1.662 seconds
查询一下
hive> select * from stu;OK1012 160 NULL10012 Abel 1701008 Kate 1681007 Alice 1631006 John 1921005 Rob 1771004 Jack 1751003 Mary 1721002 Lily 1651001 Tom 180Time taken: 2.158 seconds, Fetched: 10 row(s)
[02].加载课程表
创建课程表
hive> create table cos(id string,cos_name string,grade double)row format delimited fields terminated by '\t';OKTime taken: 0.371 seconds
本地导入
hive> load data local inpath '/opt/input/course.txt' overwrite into table cos;Loading data to table default.cosOKTime taken: 0.527 seconds
查询
hive> select * from cos;OK1001 en 85.01001 ma 100.01002 en 72.01002 ma 90.01003 en 60.01003 ma 85.01004 en 95.01004 ma 80.01005 en 88.01005 ma 70.01006 en 78.01006 ma 86.01007 en 81.01007 ma 60.01008 en 68.01008 ma 85.0Time taken: 0.195 seconds, Fetched: 16 row(s)
