课程表的多表联合查询

张开发
2026/4/9 1:18:04 15 分钟阅读

分享文章

课程表的多表联合查询
SELECT*FROM score inner join student; select count(*) from score; select count(*) from student; select (select count(*) from score)*(select count(*)FROM student); select score.studentNo学号,studemtName学生姓名,sum(result)该生总分, avg(result)平均分,count(result)考生人数 from score inner join student on score.studentNostudent.studentNo GROUP BY score.studentNo having count(result)2 order by avg(result)desc; select s.courseNo课程编号,c.courseName课程名称,sum(result)科目总分,avg(result)平均分,count(result)考试人数 from score as s inner join course as c on s.courseNoc.courseNo GROUP BY s.courseNo having count(result)3 ORDER BY avg(result) desc; select sc.studentNo学生编号,st.studentName学生姓名, sc.courseNo课程编号,co.courseName课程名称, sc.result成绩 from score as sc inner join student as st on sc.studentNost.studentNo inner join course co on sc.courseNoco.courseNo where st.classNO202202;

更多文章