💡 조회
- select 열 from 테이블 where 조건 order by asc / desc;
💡 조건
- 다중 : where (조건1) and (조건2)
- 문자열 : where 열 like '문자'
- where 열 like '____03___'
- where 열 like '%사원'
- 널 제외 : where 열 is not null
💡 날짜 변환
- select 열1, 열2, date_format(날짜열, '%Y-%m-%d') as 날짜열 from 테이블
💡 정렬
(new)
- 열1 오름차순, 같으면 열2 내림차순 : order by 열1 asc, 열2 desc;
SELECT DR_NAME, DR_ID, MCDP_CD, DATE_FORMAT(HIRE_YMD, '%Y-%m-%d') AS HIRE_YMD
FROM DOCTOR
WHERE (MCDP_CD LIKE 'CS') OR (MCDP_CD LIKE'GS')
ORDER BY HIRE_YMD DESC, DR_NAME ASC;