문제를 이해하고 있다면 바로 풀이를 보면 됨
전체 코드로 바로 넘어가도 됨
마음대로 번역해서 오역이 있을 수 있음
Table: Courses
| Column Name | Type |
|---|---|
| student | varchar |
| class | varchar |
(student, class)는 이 테이블의 기본 키(고유 값을 가진 열들의 조합)이다.
이 표의 각 행은 학생의 이름과 수강 중인 학급을 나타낸다.
학생 수가 5명 이상인 모든 학급을 찾는 코드를 작성해라.
결과는 순서와 상관없이 표 형태로 반환해라.
Input:
Courses table
| student | class |
|---|---|
| A | Math |
| B | English |
| C | Math |
| D | Biology |
| E | Math |
| F | Computer |
| G | Math |
| H | Math |
| I | Math |
Output:
| class |
|---|
| Math |
Explanation:
-- Write your PostgreSQL query statement below
select class
from Courses
group by class
having count(student) >= 5;