프로그래머스_진료과별 총 예약 횟수 출력하기
진료과 코드 '별' -> GROUP BY 예약건수 -> COUNT 정렬 -> ORDER BY
SELECT MCDP_CD AS '진료과코드', COUNT(PT_NO) AS '5월예약건수' FROM APPOINTMENT WHERE YEAR(APNT_YMD)=2022 AND MONTH(APNT_YMD)=05 #WHERE APNT_YMD LIKE '2022-05%' GROUP BY MCDP_CD ORDER BY COUNT(PT_NO), MCDP_CD