美文网首页
数据库(20180519)

数据库(20180519)

作者: 啦啦啦_79e6 | 来源:发表于2018-05-09 09:40 被阅读0次

    ✔检索选修课程包含LIU老师所授课程的学生学号

    select sno

    from sc

    where cno in

    (select cno

    from c

    where tname='LIU')

    ✔检索选修课程包含LIU老师所授全部课程的学生学号

    select distinct sno

    from sc X

    where not exists

    (select *

    from sc y

    where cno in

      (select cno

      from c

      where tname='LIU')

      and not exists

      (select *

      from sc z

      where z.sno=x.sno and z.cno=x.cno)

    )


    ■求LIU老师所授课程的每门课程的学生平均成绩

    select sc.cno,AVG(grade)

    from sc,c

    where sc.cno=c.cno

    and tname='LIU'

    group by sc.cno

    相关文章

      网友评论

          本文标题:数据库(20180519)

          本文链接:https://www.haomeiwen.com/subject/defnrftx.html