1.查询没有学全所有课的同学的学号、姓名
select sno,sname from xs where exists (select * from kc
where not exists (select * from sc
where cno=kc.cno and sno=xs.sno ) )
2.查询选修“黄”老师所授课程的学生中,成绩最高的学生姓名及其成绩
select top 1 sname from xs
where not exists (select * from kc
where teacher='黄泉' and kc.cno='3' and exists (select * from sc
where kc.cno=cno group by grade) )
3.查询全部学生都选修的课程的课程号和课程名
Select cno,cname From kc
where not exists (select * from sc
Where cno=kc.cno)
Select cno,cname From kc,(select where
4.查询至少选修C1和C3课程的学生学号
select DISTINCT sno from xs_kc Z where not exists(
select * from kc where (cno = '001' or cno = '003') and not exists (
select * from xs_kc where sno = z.sno and cno = kc.cno ))
5.求选修2号课的学生中,成绩比选修1号课的最低成绩要高的学生的学号和成绩
select sno,grade from xs_kc where cno = '002' and grade > ( select min(grade) from xs_kc where cno = '001')
6.列出每门课程中成绩最高的选课信息
select * from xs_kc , (select cno,max(grade) as maxgrade from xs_kc group by cno ) z
where xs_kc.cno = z.cno and xs_kc.grade = z.maxgrade order by (xs_kc.cno)
因篇幅问题不能全部显示,请点此查看更多更全内容