5、查询没学过“叶平”⽼师课的同学的学号、姓名:SELECT SId,StuName FROM student WHERE SId NOT in(SELECT s.SId FROM teacher t,sc s, course c WHERE t.Tname = '叶平'AND c.TId = t.TId AND c.CId = s.CId )在MySQL命令⾏中的运⾏情况:总结:运⽤了not in 和内嵌select from 的...
学号、姓名;查询没学过“叶平”⽼师课的同学的学号、姓名:我们反着来!不是要查没上过课的同学的名字吗。我们先查上叶平的课的学⽣。思路:1.先去查叶平上的课的课程id:SELECT t1.courseid kid FROM tblcourse t1,(SELECT tblteacher.TeaId tid FROM tblteacher WHERE tblteacher.TeaName='叶平') ...
5、查询没学过“叶平”老师课的同学的学号、姓名: SELECTSId, StuNameFROMstudentWHERESIdNOTin(SELECTs.SIdFROMteacher t,sc s, course cWHEREt.Tname='叶平'ANDc.TId=t.TIdANDc.CId=s.CId ) 在MySQL命令行中的运行情况: 总结:运用了not in 和 内嵌select from 的技术,在联系到多个表多查询或者一表多...