用一条sql查询出每门课程都大于80分的学生姓名
准备:
表名:testscore
表字段及值

方法一:
SELECT name from testscore GROUP BY name HAVING min(score)>80
结果图:

方法二:
SELECT DISTINCT name from testscore where name not in (select name from testscore where score<80)
结果图:

方法三:
SELECT * from (SELECT name,min(score) 最小成绩 from testscore GROUP BY name) t where t.最小成绩>80
结果图:


浙公网安备 33010602011771号