Skip to content

Commit 690a7fe

Browse files
committed
[level 3] Title: 대여 횟수가 많은 자동차들의 월별 대여 횟수 구하기, Time: 0.00 ms, Memory: 0.0 MB -BaekjoonHub
1 parent 372e45c commit 690a7fe

2 files changed

Lines changed: 16 additions & 15 deletions

File tree

프로그래머스/3/151139. 대여 횟수가 많은 자동차들의 월별 대여 횟수 구하기/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Empty
1616

1717
### 제출 일자
1818

19-
2025년 11월 05일 10:23:18
19+
2025년 11월 10일 11:31:21
2020

2121
### 문제 설명
2222

Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1+
-- 코드를 입력하세요
12
SELECT
2-
MONTH(START_DATE) AS MONTH,
3-
CAR_ID,
4-
COUNT(*) AS RECORDS
5-
FROM CAR_RENTAL_COMPANY_RENTAL_HISTORY
6-
WHERE START_DATE BETWEEN '2022-08-01' AND '2022-10-31'
7-
AND CAR_ID IN (
8-
SELECT CAR_ID
9-
FROM CAR_RENTAL_COMPANY_RENTAL_HISTORY
10-
WHERE START_DATE BETWEEN '2022-08-01' AND '2022-10-31'
11-
GROUP BY CAR_ID
12-
HAVING COUNT(*) >= 5
13-
)
14-
GROUP BY MONTH(START_DATE), CAR_ID
15-
ORDER BY MONTH ASC, CAR_ID DESC;
3+
month(start_date) as month,
4+
car_id,
5+
count(history_id) as records
6+
from CAR_RENTAL_COMPANY_RENTAL_HISTORY
7+
where start_date between '2022-08-01' and '2022-10-31'
8+
and car_id in (
9+
select car_id
10+
from CAR_RENTAL_COMPANY_RENTAL_HISTORY
11+
where start_date between '2022-08-01' and '2022-10-31'
12+
group by car_id
13+
having count(history_id) >=5
14+
)
15+
group by month, car_id
16+
order by month, car_id desc;

0 commit comments

Comments
 (0)