MySQL two column timestamp default NOW value ERROR 1067

前端 未结 4 1762
耶瑟儿~
耶瑟儿~ 2020-12-30 15:09

I have table as shown below. In order to workaround one default now column restriction of MySQL I used the tip as shown here

CREATE  TABLE IF NOT E         


        
4条回答
  •  渐次进展
    2020-12-30 15:19

    To do this and have it work:

    col1 TIMESTAMP DEFAULT 0,
    
    col2 TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 
    

    You don't need a trigger for col1, just ensure the value is NULL in your query. The answer is in the certification guide.

提交回复
热议问题