프로그래머스 > 코딩테스트 연습 > SQL 고득점 Kit

https://programmers.co.kr/learn/challenges

https://programmers.co.kr/learn/courses/30/lessons/59414

 

코딩테스트 연습 - DATETIME에서 DATE로 형 변환

ANIMAL_INS 테이블은 동물 보호소에 들어온 동물의 정보를 담은 테이블입니다. ANIMAL_INS 테이블 구조는 다음과 같으며, ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE는 각각 동물의 아이디

programmers.co.kr

 

 

 

2014-08-08 04:20:00 ▶ 2014-08-08

DATE_FORMAT(DATETIME, '%Y-%m-%d')

 

%Y   =>   2014

%y    =>   14

 

%M   =>  August

%m   =>   08

 

%D   =>  8th

%d   =>   08

 

 

 

https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_date-format

 

MySQL :: MySQL 5.7 Reference Manual :: 12.7 Date and Time Functions

12.7 Date and Time Functions This section describes the functions that can be used to manipulate temporal values. See Section 11.2, “Date and Time Data Types”, for a description of the range of values each date and time type has and the valid formats

dev.mysql.com