标签:
选课系统表结构如下:
学生表:student(sno,sname,sex,age,class)
课程表:course(cno,cname)
选课表:sc(sno,cno,score)
(1)查询选修了‘数据库应用‘的学生学号和姓名
(2)查询选修了3门课程的学生姓名和学号?
例如,做如下测试数据:
(1)
SELECT sno,sname FROM student WHERE student.sno in(SELECT sno from sc WHERE sc.cno=(select cno from course WHERE course.cname="数据库应用"))
(2)select sno,sname from student where sno in (select sno from sc group by sno having count(sno) = 3)
标签:
原文地址:http://my.oschina.net/airship/blog/387689