求解一道SQL题

2025-03-23 05:54:37
推荐回答(5个)
回答1:

select s.sname
from Student s,Course c,StudentCourse sc
where s.sid=sc.sid
and c.cid=sc.cid
group by s.sname
having count(sc.cid) = (select count(*) from Course);

回答2:

select sName from Student where not exists(select * from Coursewhere not exists(select * from StudentCourse where sID =StudentCourse. sID and StudentCourse. cID =Course. cID))

回答3:

selete sName
from Student,Course,StudentCourse
where Student.sID=StudentCourse.sID and Course.cID=StudentCourse.cID

回答4:

select sName
from Student
where sID in
(select sID
from Course
group by sID
having count(distinct cID)=
(select count(*) from Course))

回答5:

select sname from student where sid in(select sid from studentcourse where cid in(select cid from course))