SELECT HISTORY_ID, CAR_ID, TO_CHAR(START_DATE, 'YYYY-MM-DD') START_DATE, TO_CHAR(END_DATE, 'YYYY-MM-DD') END_DATE
, CASE
WHEN END_DATE - START_DATE >= 29 THEN '장기 대여'
WHEN END_DATE - START_DATE < 29 THEN '단기 대여'
END AS RENT_TYPE
FROM CAR_RENTAL_COMPANY_RENTAL_HISTORY
WHERE TO_CHAR(START_DATE, 'YYYY-MM') = '2022-09'
ORDER BY HISTORY_ID DESC;
30일 기준이면 29를 빼줘야 한다.