๋ฐ์ํ
https://school.programmers.co.kr/learn/courses/30/lessons/157342
-- ์ฝ๋๋ฅผ ์
๋ ฅํ์ธ์
SELECT CAR_ID,
round(avg(datediff(date_format(END_DATE, '%Y-%m-%d'), date_format(START_DATE, '%Y-%m-%d'))+1), 1) as AVERAGE_DURATION
from CAR_RENTAL_COMPANY_RENTAL_HISTORY
group by CAR_ID
having AVERAGE_DURATION >= 7
order by AVERAGE_DURATION desc, CAR_ID desc
๋ฐ์ํ