Algorithm/SQL
[프로그래머스/오라클] 대여 횟수가 많은 자동차들의 월별 대여 횟수 구하기 - Oracle
isshosng
2023. 4. 20. 12:11
https://school.programmers.co.kr/learn/courses/30/lessons/151139
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
1
2
3
4
5
6
7
8
9
10
|
select to_char(start_date,'mm') as month,
car_id,
count(car_id) as records
from car_rental_company_rental_history
where to_char(start_date,'mm') between 08 and 10
and car_id in (select car_id from car_rental_company_rental_history
where to_char(START_DATE,'MM') between 08 and 10
group by car_id having count(car_id)>=5)
group by car_id, to_char(start_date,'mm')
order by 1,2 desc
|
cs |
반응형