File tree Expand file tree Collapse file tree
프로그래머스/3/151139. 대여 횟수가 많은 자동차들의 월별 대여 횟수 구하기 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616
1717### 제출 일자
1818
19- 2025년 11월 05일 10:23:18
19+ 2025년 11월 10일 11:31:21
2020
2121### 문제 설명
2222
Original file line number Diff line number Diff line change 1+ -- 코드를 입력하세요
12SELECT
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 ;
You can’t perform that action at this time.
0 commit comments