SELECT * FROM APPOINTMENT
SELECT mcdp_cd AS 진료과코드 , COUNT(mcdp_cd) AS 5월예약건수 FROM APPOINTMENT WHERE YEAR(apnt_ymd) = '2022' AND MONTH(apnt_ymd) = '05' GROUP BY mcdp_cd
SELECT mcdp_cd AS 진료과코드 , COUNT(mcdp_cd) AS 5월예약건수 FROM APPOINTMENT WHERE YEAR(apnt_ymd) = '2022' AND MONTH(apnt_ymd) = '05' GROUP BY mcdp_cd ORDER BY 5월예약건수 ASC, 진료과코드 ASC
함수 | 해석 |
---|---|
YEAR | 년 |
MONTH | 월 |
DAY | 일 |
HOUR | 시 |
MINUTE | 분 |
SECOND | 초 |
1. YEAR()
SELECT YEAR('2023-02-28 13:27:45')
💻 출력
2023
2. MONTH()
SELECT MONTH('2023-02-28 13:27:45')
💻 출력
2
3. DAY()
SELECT DAY('2023-02-28 13:27:45')
💻 출력
28
4. HOUR()
SELECT HOUR('2023-02-28 13:27:45')
💻 출력
13
5. MINUTE()
SELECT MINUTE('2023-02-28 13:27:45')
💻 출력
27
6. SECOND()
SELECT SECOND('2023-02-28 13:27:45')
💻 출력
45