0

I am trying to create a column where the data type is Date (not datetime) in table which gets records ingested on a daily basis by an sh script. However, in MySql Workbench I need to set a default value. A date function doesn't work. If I put null, it generates a date for historical data, but from the moment the column is created everytime the table gets new records the result will be NULL for that field. Anyone faced this before? Picture attached.

Picture here

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181
pepperjohn
  • 67
  • 1
  • 3
  • 11

1 Answers1

1

Either change your field type to datetime & use default or use triggers on before insert.

Similar question here

Krish
  • 5,917
  • 2
  • 14
  • 35