https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html
MySQL :: MySQL 8.0 Reference Manual :: 11.2.5 Automatic Initialization and Updating for TIMESTAMP and DATETIME
11.2.5 Automatic Initialization and Updating for TIMESTAMP and DATETIME TIMESTAMP and DATETIME columns can be automatically initializated and updated to the current date and time (that is, the current timestamp). For any TIMESTAMP or DATETIME column in a
dev.mysql.com
TIMESTAMP, DATATIME 열은 자동으로 업데이트 하거나 현재 날짜와 시간을 나타낸다.
CURRENT_TIMESTAMP은 현재 시각을 의미한다
DEFAULT CURRENT_TIMESTAMP : INSERT시 자동으로 현재시각이 들어간다
ON UPDATE CURRENT_TIMESTAMP : UPDATE 시 자동으로 현재 시각으로 갱신된다
CREATE TABLE TEST(
TS_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
DT_DATE DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
'Programming | Study > MySQL' 카테고리의 다른 글
[MySQL] - 대소문자 구분 안하기 (2) | 2022.02.17 |
---|---|
[MySQL] delete문으로 여러 테이블 데이터 삭제 (0) | 2022.01.19 |
[Mysql] where 1=1 (0) | 2021.09.24 |
댓글