-- DAYOFWEEK(날짜) -> 1(일요일)~7(토요일) 출력
select DAYOFWEEK(CURDATE()) as WEEKS;
1. 한글 요일로 출력
1.1. CASE WHEN THEN END 사용
select DAYOFWEEK(curdate()) as BEFORE_DATE,
case DAYOFWEEK(CURDATE())
when '1' then '일'
when '2' then '월'
when '3' then '화'
when '4' then '수'
when '5' then '목'
when '6' then '금'
when '7' then '토'
end as AFTER_DATE;
1.2. SUBSTR 사용
select DAYOFWEEK(CURDATE()) AS BEFORE_DATE, SUBSTR(_UTF8'일월화수목금토', DAYOFWEEK(CURDATE()), 1) as AFTER_DATE ;
'DB > MYSQL' 카테고리의 다른 글
[Mysql] Group by, Order by 정렬 순서 (2) | 2020.09.04 |
---|---|
[MySQL] FullText 검색, 여러개 Like (0) | 2020.09.03 |
[MySQL] Error: MySQL authentication plugin 'caching_sha2_password (0) | 2020.05.31 |
[MySQL] 버전 확인 (0) | 2020.02.23 |