建表语句点击详见
– 查询出只有两门课程的全部学生的学号和姓名
SELECT
st
.s_id
,
st
.s_name
FROM student st
LEFT JOIN score sc
ON sc
.s_id
=st
.s_id
INNER JOIN course c
ON c
.c_id
=sc
.c_id
GROUP BY st
.s_id
HAVING COUNT(1)=2
转载请注明原文地址:https://blackberry.8miu.com/read-37861.html