#Leetcode# 596. Classes More Than 5 Students

Posted zlrrrr

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了#Leetcode# 596. Classes More Than 5 Students相关的知识,希望对你有一定的参考价值。

https://leetcode.com/problems/classes-more-than-5-students/

 

There is a table courses with columns: student and class

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

For example, the table:

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

Should output:

+---------+
| class   |
+---------+
| Math    |
+---------+

 

Note:
The students should not be counted duplicate in each course.

代码:

# Write your mysql query statement below
SELECT class FROM Courses
GROUP BY class Having Count(distinct student)>=5

  FH

以上是关于#Leetcode# 596. Classes More Than 5 Students的主要内容,如果未能解决你的问题,请参考以下文章

LeetCode 596. Classes More Than 5 Students (超过5名学生的课)

LeetCode-596-超过5名学生的课程

leetcode596---超过5名学生的课

LeetCode数据库习题182,595,620,175,183,181,596

数据库专题-leetcode596. 超过5名学生的课

公司职员的英语怎么说?