방카@Dev
[MySQL] Insert 시 자동갱신 TIMESTAMP 본문
칼럼이름 / timestamp / default current_timestamp
CREATE TABLE HIST_PAY(
pay_num int auto_increment primary key,
user_id varchar(20) not null,
item_name varchar(20) not null,
item_num int not null,
pay_date timestamp default current_timestamp,
foreign key(user_id) references user(user_id) );
➡️ 예시 DB(hist_pay)
col_num | col_type | detail |
pay_num | INT | auto_increment, primary_key |
user_id | Varchar(20) | foreign key |
item_name | Varchar(20) | |
item_num | INT | |
pay_date | Timestamp | current_timestamp |