如果要开发一个选课系统要求如下:1、每个学生可以选多门课;2、课程分必选课和选修课,必选课有数学、英语、和体育三门,选修课有概率论、密码学、计算机原理
   写出选修课
   依据所设计的ER图写出满足下列条件的SQL语句,
   a、选出教“计算机原理”课程的所有老师
   b、选出选修“计算机原理”课程的所有学生
   c、选出教“计算机原理”的老师所教的学生、希望好心人帮忙

解决方案 »

  1.   

    stu    class   classType  teacher
    1.select c.name  from class a,classType b, teacher c where a.classTypeId = b.classTypeId and 
    c.id = a.teacherId and b.name = '计算机原理'
    2,和1差不多。
    3.select * from stu s where s.teacherId = (select c.id  from class a,classType b, teacher c where a.classTypeId = b.classTypeId and 
    c.id = a.teacherId and b.name = '计算机原理')
    =======
    不知道对不对。不过可以参考。。就这么个思路