首页 新闻 赞助 找找看

MySQL查询

0
[已解决问题] 解决于 2019-11-12 20:01

数据库中有如下关系:
学生表 student(stuId,stuName,stuAge,stuSex)
stuId:学号;stuName:学生姓名;stuAge:学生年龄;stuSex:学生性别
课程表 Course(courseId,courseName,teacherId)
courseId,课程编号;courseName:课程名字;teacherId:教师编号
成绩表 Scores(stuId,courseId,score)
stuId:学号;courseId,课程编号;score:成绩
教师表 Teacher(teacherId,teacherName)
teacherId:教师编号; teacherName:教师名字
请完成以下查询
查询如下课程成绩第 3 名到第 6 名的学生成绩单:企业管理(001),马克思(002),UML (003),数据库(004)
注:数据库使用MySQL数据库

诗瑶1的主页 诗瑶1 | 初学一级 | 园豆:175
提问于:2019-07-03 14:39
< >
分享
最佳答案
0

select *
from scores
where stuid in(select stuid from scores where courseId=001 order by score limit (2,5))
and stuid in(select stuid from scores where courseId=002 order by score limit (2,5))
and stuid in(select stuid from scores where courseId=003 order by score limit (2,5))
and stuid in(select stuid from scores where courseId=004 order by score limit (2,5))

奖励园豆:5
温碧泉 | 菜鸟二级 |园豆:207 | 2019-07-03 15:45

可以告知一下limit的用法吗?

诗瑶1 | 园豆:175 (初学一级) | 2019-07-14 14:58
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册