728x90
반응형
문제
https://school.programmers.co.kr/learn/courses/30/lessons/151138
정답
-- 코드를 입력하세요
SELECT
history_id as HISTORY_ID
, car_id as CAR_ID
, to_char(start_date, 'yyyy-mm-dd') as START_DATE
, to_char(end_date, 'yyyy-mm-dd') as END_DATE
, case when (end_date - start_date+1)>=30
then '장기 대여'
else '단기 대여'
end as RENT_TYPE
from car_rental_company_rental_history
where
start_date >= to_date('20220901', 'yyyy-mm-dd')
and start_date < to_date('20221001', 'yyyy-mm-dd')
order by history_id desc;
728x90
반응형
'SQL' 카테고리의 다른 글
오라클 설치할 수 없을 때 : Oracle Apex (0) | 2024.06.11 |
---|---|
[프로그래머스] 특정 기간동안 대여 가능한 자동차들의 대여비용 구하기 (0) | 2024.02.15 |
[프로그래머스] 주문량이 많은 아이스크림들 조회하기 (0) | 2024.01.09 |