1,
SELECT a.name FROM
(select name, count(*) num1 from stu where score > 60 group by name ) a
inner join
(select name, count(*) num1 from stu group by name ) b
where a.name = b.name and a.num1 = b.num1;
2,
SELECT DISTINCT a.name
FROM stu a
WHERE a.name NOT IN(SELECT DISTINCT b.name FROM stu b WHERE b.score <= 60);
3,
select name from stu
GROUP BY name
HAVING name not in(select DISTINCT name from stu where score <= 60)
4, select name from stu
GROUP BY name
having count(score) = sum(case when score > 60 then 1 else 0 end);
name subject score,找出所有科目分数大于60的人
最新推荐文章于 2021-05-19 19:49:39 发布