学生表:student(学号:sno、姓名:sname、性别:sgender、年龄:sage)
课程表:couse (课程编号:cno、课程名称:cname)
选课表:sc(学号:sno、课程编号:cno、成绩:marks)
SELECT s.sno ,
s.sname ,
c.cname
FROM student s
INNER JOIN sc t1 ON t1.sno = s.sno
INNER JOIN couse c ON sc.cno = c.cno
WHERE s.sno IN ( SELECT t.sno
FROM sc t
GROUP BY t.sno
HAVING COUNT(t.cno) = 2 )
select s.sno,s.name from student s
where s.sno in(select sno from score sc group by sc.cno having count(sc.sno)>2 )