테스트를 위한 테이블
create table test (
seq int not null primary key auto_increment,
content varchar(10),
date date not null
);
테이블 생성 명령어
현재 시간을 now()함수로 받아서 입력
insert into test (content,date) values ('test1',now());
현재 시간을 current_date로 받아서 입력
insert into test (content,date) values ('test1',current_date);
데이터가 위와 같은 포맷으로 보였으면 한다.
칼럼에 29/04/2024 같은 형식으로는 입력할수 없는거 같다.
이렇게 숫자형식으로는 들어간다.
이렇게 문자 형식으로도 들어간다.
(자동으로 변환되어서 들어가는거 같다.)
결론
date 타입인 컬럼에는 숫자 혹은
문자 형식으로만 데이터가
들어간다.
후기
date칼럼에 입력할수 있는
데이터 타입에 대해 알 수
있었다.
'linux' 카테고리의 다른 글
[Linux] dns 서버 구축하기 (0) | 2024.04.30 |
---|---|
[Linux] mysql - mysql_secure_installation (0) | 2024.04.29 |
[Linux] named.service could not be found (0) | 2024.04.26 |
[Linux] ifconfig 명령어가 실행이 되지 않을때 (0) | 2024.04.26 |
[Linux] mariadb - 설치 및 외부 클라이언트에서 접속 (0) | 2024.04.25 |