Hive sql 初级题 04
2026/6/25 13:40:56 网站建设 项目流程

(数据在Hive sql 初级题 01)

查询所有课程成绩均小于60分的学生的学号、姓名

select s.stu_id, s.stu_name from ( select stu_id, sum(if(score >= 60, 1, 0)) flag from score_info group by stu_id having flag = 0 ) t1 join student_info s on s.stu_id = t1.stu_id;

查询没有学全所有课的学生的学号、姓名

select s.stu_id, s.stu_name from student_info s left join score_info sc on s.stu_id = sc.stu_id group by s.stu_id, s.stu_name having count(course_id) < (select count(course_id) from course_info);

查询出只选修了三门课程的全部学生的学号和姓名

select student_info.stu_id, stu_name from(select stu_id from score_info group by stu_id having count(course_id)=3)t1 join student_info on student_info.stu_id=t1.stu_id

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询