-1

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?

BlueSkies
  • 109
  • 8

1 Answers1

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
  • 131,976
  • 10
  • 91
  • 107