按照学生ID字段合并两个文件中的数据,合并完成后使用where关键字筛选出成绩在60分以下的学生的姓名及成绩。
使用hive数据库
用什么代码实现
img
对于这个问题,我可以给出以下hive SQL代码实现:
SELECT a.name, a.score
FROM (
SELECT t1.name AS name, CONCAT(t1.score,',',t2.score) AS score
FROM table1 t1
JOIN table2 t2 ON t1.student_id = t2.student_id
) a
WHERE CAST(SPLIT(a.score,',')[0] AS INT) < 60;
解释一下这段代码的实现:
希望能够帮助到你!