#力扣MySQL:596. 超过5名学生的课 @FDDLC
发布日期:2021-06-30 21:05:52 浏览次数:2 分类:技术文章

本文共 696 字,大约阅读时间需要 2 分钟。

题目描述:

 

自测用例:

{"headers": {"courses": ["student", "class"]}, "rows": {"courses": [["A", "Math"], ["B", "English"], ["C", "Math"], ["D", "Biology"], ["E", "Math"], ["F", "Computer"], ["G", "Math"], ["H", "Math"], ["I", "Math"]]}}{"headers": {"courses": ["student", "class"]}, "rows": {"courses": [["A", "Math"], ["B", "English"], ["C", "Math"], ["D", "Biology"], ["E", "Math"], ["D", "Biology"], ["E", "Math"], ["D", "Biology"], ["E", "Math"], ["F", "Computer"], ["G", "Math"], ["H", "Math"], ["I", "Math"]]}}

 

SQL:

select class from(select distinct student,class from courses) t group by class having count(student)>=5

 

SQL二:

select class from courses group by class having count(distinct student)>=5

 

 

 

 

 

 

 

 

转载地址:https://liuxingchang.blog.csdn.net/article/details/117049248 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:#Java:读取全部文件内容到String中 @FDDLC
下一篇:#力扣MySQL:197. 上升的温度 @FDDLC

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年04月15日 08时17分25秒