TypechoJoeTheme

IT技术分享

统计
SQL

[LeetCode 596] Classes More Than 5 Students [MySql]

2017-09-17
/
0 评论
/
691 阅读
/
正在检测是否收录...
09/17

1. Description

There is a table courses with columns: student and class

Please list out all classes which have more than or equal to 5 students.

2. Runtime Distribution

3. Submission Details

4. Example

student class
A Math
B English
C Math
D Biology
E Math
F Computer
G Math
H Math
I Math

Should output:

class
Math

5. Code

select class from courses group by class having count(distinct student ) >= 5
MySql
朗读
赞 · 0
版权属于:

IT技术分享

本文链接:

https://idunso.com/archives/854/(转载时请注明本文出处及文章链接)