mysql练习题进阶版
Posted islvgb
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql练习题进阶版相关的知识,希望对你有一定的参考价值。
student表
1 查询"01"课程比"02"课程成绩高的学生的信息及课程分数
select student.*,s_score from student,score where c_id = 01 and score.s_id = student.s_id and score.s_id in (select s1.s_id from score s1,score s2 where s1.c_id = 01 and s2.c_id = 02 and s1.s_score >s2.s_score and s1.s_id = s2.s_id)
2 查询平均成绩大于等于60分的同学的学生编号和学生姓名和平均成绩
select sc.s_id,st.s_name,avg(s_score) from score sc left join student st on sc.s_id = st.s_id group by sc.s_id having avg(s_score)>60
3 查询所有同学的学生编号、学生姓名、选课总数、所有课程的总成绩
select st.s_id,s_name,count(c_id) sum_course,sum(s_score) sum_score from student st left join score sc on sc.s_id = st.s_id group by st.s_id
以上是关于mysql练习题进阶版的主要内容,如果未能解决你的问题,请参考以下文章
我的OpenGL学习进阶之旅NDK开发中find_library查找的系统动态库在哪里?