코딩테스트 연습 > GROUP BY > 자동차 대여 기록에서 대여중 / 대여 가능 여부 구분하기
https://school.programmers.co.kr/learn/courses/30/lessons/157340#

case 구문을 이용하여 대여중, 대여 가능 여부를 출력한다.
case 구문 내부에 where 절 서브쿼리로 '2022-10-16' 이 start_date, end_date 사이에 있는 있는가 판단하여 있다면 "대여중", 없다면 "대여 가능"을 출력한다.
select car_id,(
case
when car_id in (select car_id
from car_rental_company_rental_history
where '2022-10-16' between start_date and end_date) then "대여중"
else "대여 가능"
end
) as AVAILABILTY
from car_rental_company_rental_history
group by car_id
order by car_id desc
where 절을 통해 최대한 간추려야겠다.