开发者

MySQL Default DATETIME value

I'd like to accomplish something like the following in a MySQL Create table action

开发者_高级运维date_created datetime NOT NULL DEFAULT CURRENT_DATETIME,  
date_updated datetime NOT NULL ON UPDATE CURRENT_DATETIME,

Once again, this is a MySQL create table action and these are two of the fields in my table.


Have a look at this

TIMESTAMP Properties

From the link you can use

CREATE TABLE t (ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP
                             ON UPDATE CURRENT_TIMESTAMP);
CREATE TABLE t (ts TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
                             DEFAULT CURRENT_TIMESTAMP);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜