I want to define a new MySQL table, let's say table-1, with a timestamp column that will be initialized only on INSERT and not on UPDATE. How to do it?
Asked
Active
Viewed 22 times
1 Answers
1
you could use the deful value CURRENT_TIMESTAMP
create table table1 (
your_col your_data_type ,
......
my_insert_date_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
and let the col my_insert_date_time null in insert
ScaisEdge
- 129,293
- 10
- 87
- 97