Skip to content

Commit ecae45f

Browse files
committed
[level 1] Title: 평균 일일 대여 요금 구하기, Time: 0.00 ms, Memory: 0.0 MB -BaekjoonHub
1 parent 503f3cb commit ecae45f

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# [level 1] 평균 일일 대여 요금 구하기 - 151136
2+
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/151136)
4+
5+
### 성능 요약
6+
7+
메모리: 0.0 MB, 시간: 0.00 ms
8+
9+
### 구분
10+
11+
코딩테스트 연습 > SELECT
12+
13+
### 채점결과
14+
15+
Empty
16+
17+
### 제출 일자
18+
19+
2025년 12월 06일 17:58:06
20+
21+
### 문제 설명
22+
23+
<p>다음은 어느 자동차 대여 회사에서 대여중인 자동차들의 정보를 담은 <code>CAR_RENTAL_COMPANY_CAR</code> 테이블입니다. <code>CAR_RENTAL_COMPANY_CAR</code> 테이블은 아래와 같은 구조로 되어있으며, <code>CAR_ID</code>, <code>CAR_TYPE</code>, <code>DAILY_FEE</code>, <code>OPTIONS</code> 는 각각 자동차 ID, 자동차 종류, 일일 대여 요금(원), 자동차 옵션 리스트를 나타냅니다.</p>
24+
<table class="table">
25+
<thead><tr>
26+
<th>Column name</th>
27+
<th>Type</th>
28+
<th>Nullable</th>
29+
</tr>
30+
</thead>
31+
<tbody><tr>
32+
<td>CAR_ID</td>
33+
<td>INTEGER</td>
34+
<td>FALSE</td>
35+
</tr>
36+
<tr>
37+
<td>CAR_TYPE</td>
38+
<td>VARCHAR(255)</td>
39+
<td>FALSE</td>
40+
</tr>
41+
<tr>
42+
<td>DAILY_FEE</td>
43+
<td>INTEGER</td>
44+
<td>FALSE</td>
45+
</tr>
46+
<tr>
47+
<td>OPTIONS</td>
48+
<td>VARCHAR(255)</td>
49+
<td>FALSE</td>
50+
</tr>
51+
</tbody>
52+
</table>
53+
<p>자동차 종류는 '세단', 'SUV', '승합차', '트럭', '리무진' 이 있습니다. 자동차 옵션 리스트는 콤마(',')로 구분된 키워드 리스트(예: '열선시트', '스마트키', '주차감지센서')로 되어있으며, 키워드 종류는 '주차감지센서', '스마트키', '네비게이션', '통풍시트', '열선시트', '후방카메라', '가죽시트' 가 있습니다.</p>
54+
55+
<hr>
56+
57+
<h5>문제</h5>
58+
59+
<p><code>CAR_RENTAL_COMPANY_CAR</code> 테이블에서 자동차 종류가 'SUV'인 자동차들의 평균 일일 대여 요금을 출력하는 SQL문을 작성해주세요. 이때 평균 일일 대여 요금은 소수 첫 번째 자리에서 반올림하고, 컬럼명은 <code>AVERAGE_FEE</code> 로 지정해주세요.</p>
60+
61+
<hr>
62+
63+
<h5>예시</h5>
64+
65+
<p>예를 들어 <code>CAR_RENTAL_COMPANY_CAR</code> 테이블이 다음과 같다면</p>
66+
<table class="table">
67+
<thead><tr>
68+
<th>CAR_ID</th>
69+
<th>CAR_TYPE</th>
70+
<th>DAILY_FEE</th>
71+
<th>OPTIONS</th>
72+
</tr>
73+
</thead>
74+
<tbody><tr>
75+
<td>1</td>
76+
<td>세단</td>
77+
<td>16000</td>
78+
<td>가죽시트,열선시트,후방카메라</td>
79+
</tr>
80+
<tr>
81+
<td>2</td>
82+
<td>SUV</td>
83+
<td>14000</td>
84+
<td>스마트키,네비게이션,열선시트</td>
85+
</tr>
86+
<tr>
87+
<td>3</td>
88+
<td>SUV</td>
89+
<td>22000</td>
90+
<td>주차감지센서,후방카메라,가죽시트</td>
91+
</tr>
92+
</tbody>
93+
</table>
94+
<p>'SUV' 에 해당하는 자동차들의 평균 일일 대여 요금은 18,000 원 이므로, 다음과 같은 결과가 나와야 합니다.</p>
95+
<table class="table">
96+
<thead><tr>
97+
<th>AVERAGE_FEE</th>
98+
</tr>
99+
</thead>
100+
<tbody><tr>
101+
<td>18000</td>
102+
</tr>
103+
</tbody>
104+
</table>
105+
106+
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- 코드를 입력하세요
2+
SELECT ROUND(AVG(DAILY_FEE), 0) as AVERAGE_FEE
3+
FROM CAR_RENTAL_COMPANY_CAR
4+
WHERE CAR_TYPE = "SUV"
5+
GROUP BY CAR_TYPE

0 commit comments

Comments
 (0)