-- 6、查询学过“张三”老师所教的所有课的同学的学号、姓名(重点)SELECT d.s_id,d.s_name,a.t_name,c.c_idFROMteacher as aINNER JOIN course as b ON a.t_id=b.t_idINNER JOIN score as c ON b.c_id=c.c_idINNER JOIN student as d ON c.s_id=d.s_idWHERE a.t_name='张三'ORDER BY d.s_id
-- 6、查询学过“张三”老师所教的所有课的同学的学号、姓名(重点)SELECT a.s_id,a.s_name FROMstudent as a INNER JOIN (SELECT s_id FROM scoreWHERE c_id in(SELECT c_id FROM courseWHERE t_id in(SELECT t_id FROM teacherWHERE t_name='张三')))as bON a.s_id=b.s_id