用SQL嵌套查询语句查询选修了全部课程的学生的姓名.

2024-11-28 15:58:39
推荐回答(2个)
回答1:

需要3张表,学生表student,选课表sc和课程表course,
select sname from student
where not exists(select * from course where not exists
(select * from sc where sno=student.sno and cno=course.cno))

回答2:

SELECT St_Name
FROM St_Info
where St_ID in
(SELECT St_ID
FROM S_C_Info
WHERE C_No in
(SELECT C_No
FROM C_Info))