330. 대여 기록이 존재하는 자동차 리스트 구하기

김해준's avatar
Feb 06, 2026
330. 대여 기록이 존재하는 자동차 리스트 구하기

언어 : MySQL

문제

notion image
notion image

풀이

CAR_RENTAL_COMPANY_CAR 테이블 데이터 확인
notion image
CAR_RENTAL_COMPANY_CAR의 CAR_TYPE이 세단인 경우 조회
notion image
CAR_RENTAL_COMPANY_RENTAL_HISTORY 테이블 조회
notion image
10월에 대여 기록이 있는 경우 조회(대여 시작일이 10월 중)
notion image
CAR_RENTAL_COMPANY_RENTAL_HISTORY 테이블에
CAR_RENTAL_COMPANY_CAR 테이블 조인하기
notion image
조인 조건을 각 테이블의 Car_ID가 동일한 경우로 조정
notion image
자동차 ID값을 기준 그룹화 하고 자동차 ID값만 출력
notion image
자동차 ID값을 기준으로 내림차순 정렬
notion image
notion image
Share article