上机练习1
查询每个年级的总学时,并按照升序排序
SELECT SUM(ClassHour) AS 总学时,GradeId 年级 FROM Subject GROUP BY GradeId
查询每个参加考试的学员的平均分
SELECT AVG(StudentResult)AS 平均分,StudentNo AS 学号 FROM Result GROUP BY StudentNo
查询每门课程的平均分,并按照降序排列
SELECT AVG(StudentResult) AS 平均分,SubjectId AS 课程号 FROM Result GROUP BY SubjectId ORDER BY AVG(StudentResult) DESC
查询每个学生参加所有考试的总分,并降序
SELECT SUM(StudentResult) AS 总分,StudentNo AS 学号 FROM Result GROUP BY StudentNo ORDER BY SUM(StudentResult) DESC
SQL第十一章上机练习1
最新推荐文章于 2021-04-07 19:02:41 发布