educoder中Hive综合应用案例 — 学生成绩查询

第1关:计算每个班的语文总成绩和数学总成绩

---------- 禁止修改 ----------
 drop database if exists mydb cascade;
  set hive.auto.convert.join = false;
set hive.ignore.mapjoin.hint=false;
---------- 禁止修改 ----------
---------- begin ----------
---创建mydb数据库
create database if not exists mydb;
---使用mydb数据库
use mydb;
---创建表score
create table if not exists score(
name string comment '姓名',
chinese string comment '语文成绩',
maths string comment '数学成绩'
)
row format delimited fields terminated by ','
stored as textfile;
---导入数据:/root/data/step1_files/score.txt
load data local inpath '/root/data/step1_files/score.txt' into table score;
--创建表class
create table if not exists class(
stuname string comment '姓名',
classname string comment '所在班级'
)
row format delimited fields terminated by ','
stored as textfile;
---导入数据:/root/data/step1_files/class.txt
load data local inpath '/root/data/step1_files/cl

你可能感兴趣的:(Educoder题目解析,hive,hadoop,数据仓库)