建表语句点击详见
– 查询学过编号为"01"并且也学过编号为"02"的课程的同学的信息
SELECT st.*
FROM student st INNER JOIN score sc ON sc.s_id=st.s_id AND sc.c_id='01'WHERE st.s_id IN (SELECT st2.s_id
FROM student st2
INNER JOIN score sc2 ON sc2.s_id=st2.s_id AND sc2.c_id='02'
)
建表语句点击详见
– 查询学过编号为"01"并且也学过编号为"02"的课程的同学的信息
SELECT st.*
FROM student st INNER JOIN score sc ON sc.s_id=st.s_id AND sc.c_id='01'WHERE st.s_id IN (SELECT st2.s_id
FROM student st2
INNER JOIN score sc2 ON sc2.s_id=st2.s_id AND sc2.c_id='02'
)