MySql 1596. Class with more than 5 students

✌✌✌The ancients have something to say, good memory is not as good as bad writing. A journey of a thousand miles begins with a single step. Thousands of lines of code every day are indispensable. Write a summary every day. Target a big factory. If you are full of hope, you will be invincible, hahaha! ! ! ✌✌✌

Insert picture description here

1. Title description

Insert picture description here

2. Answer ideas

> 首先根据课程进行分组
> 但是有个问题就是有可能出现学生重复选课
> 所以分组后要对其去重输出
> 或者在分组前将其去重之后再分组

3. MySql language

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

Guess you like

Origin blog.csdn.net/m0_47256162/article/details/115039691