inblog logo
|
silver
    SQL문제풀기

    [SQL문제풀기] 대여 기록이 존재하는 자동차 리스트 구하기

    silver's avatar
    silver
    Jan 27, 2025
    [SQL문제풀기] 대여 기록이 존재하는 자동차 리스트 구하기
    Contents
    문제MYSQLORACLE

    문제

    school.programmers.co.kr
    https://school.programmers.co.kr/learn/courses/30/lessons/157341

    MYSQL

    내가 작성한 정답

    SELECT distinct c.car_id from CAR_RENTAL_COMPANY_CAR c join CAR_RENTAL_COMPANY_RENTAL_HISTORY h on c.car_id = h.car_id where c.car_type = '세단' and month(h.start_date) = 10 order by 1 desc
    SELECT c.car_id from car_rental_company_car c join car_rental_company_rental_history h on c.car_id = h.car_id where c.car_type = '세단' and month(h.start_date) = 10 group by c.car_id order by 1 desc

    ORACLE

    내가 작성한 정답

    SELECT distinct c.car_id from CAR_RENTAL_COMPANY_CAR c join CAR_RENTAL_COMPANY_RENTAL_HISTORY h on c.car_id = h.car_id where c.car_type = '세단' and to_char(h.start_date,'mm') = '10' order by car_id desc
    Share article

    silver

    RSS·Powered by Inblog