学生和课程是多对多,有学生表,课程表,关系表。问写出SQL找出选课大...

学生和课程是多对多,有学生表,课程表,关系表。问写出SQL找出选课大于5门以上的学生

select * from 学生表 where stuId in (select stuId from 关系表 group by stuId having count(*)>5;)
其中stuId是学生表主键(暂定)
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-04-08
select * from 学生表 where studentid in (select studentid from 关系表 group by studentid having count(*)>5)
子查询:select studentid from 关系表 group by studentid having count(*)>5 找出符合的ID本回答被提问者和网友采纳
第2个回答  2011-04-08
你在问什么?