– 查询没学过"张三"老师授课的同学的信息
SELECT s.* FROM student s WHERE s.s_id NOT IN(
SELECT
st.s_id
FROM student st
LEFT JOIN score sc ON sc.s_id=st.s_id
LEFT JOIN course c ON c.c_id=sc.c_id
LEFT JOIN teacher t ON t.t_id=c.t_id
WHERE t.t_name="张三"
)
– 查询没学过"张三"老师授课的同学的信息
SELECT s.* FROM student s WHERE s.s_id NOT IN(
SELECT
st.s_id
FROM student st
LEFT JOIN score sc ON sc.s_id=st.s_id
LEFT JOIN course c ON c.c_id=sc.c_id
LEFT JOIN teacher t ON t.t_id=c.t_id
WHERE t.t_name="张三"
)