分享

SQL简单查询-2

 杜桥伊人 2020-05-08

12、查询“计算机系”与“电子工程系” 中不同职称的教师tname和prof

select tname,prof from teacher a where prof not in(select prof from teacher b where a.depart!=b.depart)

13、查询和学号为107的同学同年出生的所有学生的Sno、Sname和Sbirthday列

select sno,sname,sbirthday  from student where  year(sbirthday) =(select year(sbirthday) from student where sno='107')

14、查询出“计算机系“教师所教课程的成绩表

select score.sno,score.cno,score.degree from teacher 

inner join course on teacher.tno = course.tno

inner join score on course.cno = score.cno

where teacher.depart = '计算机系'

或者:

select sno,Cno ,Degree from Score where Cno in (select Cno from Course where Tno in (select tno from Teacher where Depart='计算机系'))

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多