视频讲解地址:https://www.bilibili.com/video/BV1BG4y1v7Ps/?spm_id_from=333.788&vd_source=aa4fb0436f6d978af872cafb81a01178
Hive面试题系列第二题-行转列问题
题目:求语文课程成绩大于英语课程成绩的学生的学号
表结构:
- create table score_table(
-
id int,
-
stuid int,
-
course string,
-
score bigint
- )
- row format delimited
- FIELDS TERMINATED BY ‘|’
- LINES TERMINATED BY ‘\n’;
用户表数据: - 1|1|yuwen|43
- 2|1|shuxue|55
- 3|1|english|55
- 4|2|yuwen|77
- 5|2|shuxue|88
- 6|2|english|88
- 7|3|yuwen|98
- 8|3|shuxue|65
- 9|3|english|80