1일 1솔

[프로그래머스] DATETIME에서 DATE로 형 변환 (SQL)

junmukbap98 2023. 12. 28. 12:43

문제 링크: https://school.programmers.co.kr/learn/courses/30/lessons/59414#fn1

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

 

Key point

 

MySQL DATE_FORMAT() Function

W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

www.w3schools.com

 

-- 코드를 입력하세요
SELECT ANIMAL_ID, NAME, DATE_FORMAT(DATETIME, '%Y-%m-%d') AS '날짜'
FROM ANIMAL_INS;

 

그렇다면 이전 문제도 DATE_FORMAT을 활용해서 사용할 수 있다.