Skip to content

Commit 4f9021a

Browse files
committed
[level 3] Title: 대장균의 크기에 따라 분류하기 1, Time: , Memory: undefined -BaekjoonHub
1 parent 60d781e commit 4f9021a

File tree

2 files changed

+134
-0
lines changed

2 files changed

+134
-0
lines changed
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# [level 3] 대장균의 크기에 따라 분류하기 1 - 299307
2+
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/299307)
4+
5+
### 성능 요약
6+
7+
메모리: undefined, 시간:
8+
9+
### 구분
10+
11+
코딩테스트 연습 > SELECT
12+
13+
### 채점결과
14+
15+
합계: 100.0 / 100.0
16+
17+
### 제출 일자
18+
19+
2025년 11월 04일 10:48:30
20+
21+
### 문제 설명
22+
23+
<p>대장균들은 일정 주기로 분화하며, 분화를 시작한 개체를 부모 개체, 분화가 되어 나온 개체를 자식 개체라고 합니다.<br>
24+
다음은 실험실에서 배양한 대장균들의 정보를 담은 <code>ECOLI_DATA</code> 테이블입니다. <code>ECOLI_DATA</code> 테이블의 구조는 다음과 같으며, <code>ID</code>, <code>PARENT_ID</code>, <code>SIZE_OF_COLONY</code>, <code>DIFFERENTIATION_DATE</code>, <code>GENOTYPE</code> 은 각각 대장균 개체의 ID, 부모 개체의 ID, 개체의 크기, 분화되어 나온 날짜, 개체의 형질을 나타냅니다.</p>
25+
<table class="table">
26+
<thead><tr>
27+
<th>Column name</th>
28+
<th>Type</th>
29+
<th>Nullable</th>
30+
</tr>
31+
</thead>
32+
<tbody><tr>
33+
<td>ID</td>
34+
<td>INTEGER</td>
35+
<td>FALSE</td>
36+
</tr>
37+
<tr>
38+
<td>PARENT_ID</td>
39+
<td>INTEGER</td>
40+
<td>TRUE</td>
41+
</tr>
42+
<tr>
43+
<td>SIZE_OF_COLONY</td>
44+
<td>INTEGER</td>
45+
<td>FALSE</td>
46+
</tr>
47+
<tr>
48+
<td>DIFFERENTIATION_DATE</td>
49+
<td>DATE</td>
50+
<td>FALSE</td>
51+
</tr>
52+
<tr>
53+
<td>GENOTYPE</td>
54+
<td>INTEGER</td>
55+
<td>FALSE</td>
56+
</tr>
57+
</tbody>
58+
</table>
59+
<p>최초의 대장균 개체의 <code>PARENT_ID</code> 는 NULL 값입니다.</p>
60+
61+
<hr>
62+
63+
<h5>문제</h5>
64+
65+
<p>대장균 개체의 크기가 100 이하라면 'LOW', 100 초과 1000 이하라면 'MEDIUM', 1000 초과라면 'HIGH' 라고 분류합니다. 대장균 개체의 ID(<code>ID</code>) 와 분류(<code>SIZE</code>)를 출력하는 SQL 문을 작성해주세요.이때 결과는 개체의 ID 에 대해 오름차순 정렬해주세요.</p>
66+
67+
<hr>
68+
69+
<h5>예시</h5>
70+
71+
<p>예를 들어 <code>ECOLI_DATA</code> 테이블이 다음과 같다면</p>
72+
<table class="table">
73+
<thead><tr>
74+
<th>ID</th>
75+
<th>PARENT_ID</th>
76+
<th>SIZE_OF_COLONY</th>
77+
<th>DIFFERENTIATION_DATE</th>
78+
<th>GENOTYPE</th>
79+
</tr>
80+
</thead>
81+
<tbody><tr>
82+
<td>1</td>
83+
<td>NULL</td>
84+
<td>17</td>
85+
<td>2019/01/01</td>
86+
<td>5</td>
87+
</tr>
88+
<tr>
89+
<td>2</td>
90+
<td>NULL</td>
91+
<td>150</td>
92+
<td>2019/01/01</td>
93+
<td>3</td>
94+
</tr>
95+
<tr>
96+
<td>3</td>
97+
<td>1</td>
98+
<td>4000</td>
99+
<td>2020/01/01</td>
100+
<td>4</td>
101+
</tr>
102+
</tbody>
103+
</table>
104+
<p>대장균 개체 ID(<code>ID</code>) 1,2,3 에 대해 개체의 크기는 각각 17, 150, 4000 이므로 분류된 이름은 각각 'LOW', 'MEDIUM', 'HIGH' 입니다. 따라서 결과를 개체의 ID 에 대해 오름차순 정렬하면 다음과 같아야 합니다.</p>
105+
<table class="table">
106+
<thead><tr>
107+
<th>ID</th>
108+
<th>SIZE</th>
109+
</tr>
110+
</thead>
111+
<tbody><tr>
112+
<td>1</td>
113+
<td>LOW</td>
114+
</tr>
115+
<tr>
116+
<td>2</td>
117+
<td>MEDIUM</td>
118+
</tr>
119+
<tr>
120+
<td>3</td>
121+
<td>HIGH</td>
122+
</tr>
123+
</tbody>
124+
</table>
125+
126+
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
SELECT
2+
ID,
3+
CASE
4+
WHEN SIZE_OF_COLONY > 1000 THEN 'HIGH'
5+
WHEN SIZE_OF_COLONY > 100 THEN 'MEDIUM'
6+
ELSE 'LOW'
7+
END AS SIZE
8+
FROM ECOLI_DATA;

0 commit comments

Comments
 (0)