커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
5-6. 포맷함수에서 요일 한글로 나타내는 방법 문의
엑셀보다 쉽고 빠른 SQL
챕터 5
북마크
지*
댓글
1
추천
0
조회수
5
조회수
5
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.



강의자료에는 나와있지 않지만 요일을 구하는 형식에서 date_format(date(date), '%W')를 입력하면

영어 요일(예: Wednesday)로 데이터를 구한다는 것을 알게되었습니다.


만약 요일을 한글로 치환하고 싶다면 아래 방식으로 쿼리를 추가 작성해야 하나요?

더 간편한 방법이 있나요?


select date(date) date_type,
date_format(date(date), '%Y') "년",
date_format(date(date), '%m') "월",
date_format(date(date), '%d') "일",
date_format(date(date), '%w') "요일",
case when date_format(date(date), '%w')=1 then '월'
     when date_format(date(date), '%w')=2 then '화'
     when date_format(date(date), '%w')=3 then '수'
     when date_format(date(date), '%w')=4 then '목'
     when date_format(date(date), '%w')=5 then '금'
     when date_format(date(date), '%w')=6 then '토'
     when date_format(date(date), '%w')=0 then '일'
     end
from payments



취소
 공유
취소
댓글 0
댓글 알림
나의얼굴