这似乎是一个非常简单的一个,但我很难想出来.我想要一个列在我的数据库中列出了创建一个记录,另一列说明何时更新.这是我的理解,我应该能够使用所有这一切只使用
MySQL.所有的帮助是赞赏:)
In a CREATE TABLE statement,the first TIMESTAMP column can be declared in any of the following ways:
With both DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP clauses,the column has the current timestamp for its default value,and is automatically updated.
With neither DEFAULT nor ON UPDATE clauses,it is the same as DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP.
With a DEFAULT CURRENT_TIMESTAMP clause and no ON UPDATE clause,the column has the current timestamp for its default value but is not automatically updated.
With no DEFAULT clause and with an ON UPDATE CURRENT_TIMESTAMP clause,the column has a default of 0 and is automatically updated.
With a constant DEFAULT value,the column has the given default and is not automatically initialized to the current timestamp. If the column also has an ON UPDATE CURRENT_TIMESTAMP clause,it is automatically updated; otherwise,it has a constant default and is not automatically updated.