v1.0 可编辑可修改 (4) 查询各个系的学生人数; SELECT COUNT (SNO) AS COUNT FROM Student GROUP BY DEPTNO; 2. 连接查询 查询信息系年龄在21岁以下的女生的姓名及其年龄; SELECT SNAME,AGE FROM Student,Dept WHERE AGE <21 AND = 3. 嵌套查询 (1) 查询选修课总学分在10学分以下的学生的姓名; SELECT Sname FROM Student WHERE in ( SELECT FROM Student,SC,Course WHERE = AND = GROUP BY HAVING SUM (CREAIT)<10 ) 9
v1.0 可编辑可修改 (2) 查询各门课程最高成绩的学生的姓名及其成绩; SELECT SNAME,GRADE FROM Student,SC S1 WHERE = AND GRADE = ( SELECT MAX(GRADE) FROM SC S2 WHERE = GROUP BY ) (3) 查询选修了1001号学生所选修的全部课程的学生的学号; SELECT DISTINCT SNO FROM SC SCX WHERE NOT EXISTS ( SELECT * FROM SC SCY WHERE ='1001' AND NOT EXISTS ( SELECT * FROM SC SCZ WHERE = AND = ) ) 10
v1.0 可编辑可修改 (4)查询选修了张星老师所开设的全部课程的学生的姓名; SELECT SNAME FROM Student WHERE EXISTS ( SELECT FROM SC,Course,Teacher,Student WHERE = AND = AND TNAME ='张星' AND = ) 注意:红色字体的实验内容待讲完相应知识点后在做。
11