코딩테스트/SQL
[SQL] 프로그래머스 자동차 대여 기록에서 대여중 / 대여 가능 여부 구분하기(*)
유(YOO)
2023. 2. 9. 23:46
https://school.programmers.co.kr/learn/courses/30/lessons/157340
SELECT
CAR_ID,
IF (CAR_ID IN (
SELECT
CAR_ID
FROM CAR_RENTAL_COMPANY_RENTAL_HISTORY
WHERE "2022-10-16" BETWEEN START_DATE AND END_DATE), "대여중", "대여 가능")
AS AVAILABILITY
FROM CAR_RENTAL_COMPANY_RENTAL_HISTORY
GROUP BY CAR_ID
ORDER BY CAR_ID DESC;