본문 바로가기
Develop/Database

[Leetcode] 596. Classes More Than 5 Students (MySQL) 문제 및 풀이

by 초코칩프라푸치노 2021. 12. 30.

문제) Leetcode - SQL - Classes More Than 5 Students

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

 

Classes More Than 5 Students - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

학생 수가 5명 이상인 수업을 고르는 문제였습니다. group by를 통해 수업 별로 묶은 후, count를 통해 학생 수를 계산합니다.

 

풀이)

select class
from courses
group by class
having count(student) >= 5
반응형

댓글