💻 하나씩 차곡차곡/프로그래머스 (SQL)

[String, Date/LEVEL4] 취소되지 않은 진료 예약 조회하기 (MySQL/Oracle)

뚜루리 2023. 6. 30. 12:11
728x90
320x100

MySQL

SELECT    A.APNT_NO
        , C.PT_NAME
        , C.PT_NO
        , A.MCDP_CD
        , B.DR_NAME
        , A.APNT_YMD
FROM APPOINTMENT A, DOCTOR B, PATIENT C
WHERE A.MDDR_ID = B.DR_ID
AND A.PT_NO = C.PT_NO
AND A.APNT_YMD LIKE '2022-04-13%'
AND A.MCDP_CD = 'CS'
AND APNT_CNCL_YN = 'N'
ORDER BY A.APNT_YMD

 


 

Oracle

SELECT 
      B.APNT_NO
    , A.PT_NAME
    , A.PT_NO
    , B.MCDP_CD
    , C.DR_NAME
    , B.APNT_YMD
FROM PATIENT A, APPOINTMENT B, DOCTOR C
WHERE A.PT_NO = B.PT_NO
AND C.DR_ID = B.MDDR_ID
AND B.MCDP_CD = 'CS'
AND TO_CHAR(B.APNT_YMD, 'YYYY-MM-DD') = '2022-04-13'
AND B.APNT_CNCL_YN = 'N'
ORDER BY B.APNT_YMD
;
728x90
320x100