Timestamp data type in MySQL is a very special data type, he can automatically update the time when you update the record without using the program update timestamp
Usually there is a field in the table that creates date, and other databases have the option of default values. MySQL also has a default value of timestamp, but in MySQL, not only is the insertion of the modification will also update the value of Timestamp!
Thus, it is not the creation date, as the update date to use better!
So to record the creation date in MySQL, you have to use datetime and then use the now () function to complete!
1: If the default Current_timestamp and on UPDATE CURRENT_TIMESTAMP clauses are defined, the column value defaults to the current timestamp and is updated automatically.
2: If you do not use the default or ON UPDATE clause, it is equivalent to the default current_timestamp on update current_timestamp.
3: If there is only a default CURRENT_TIMESTAMP clause and no on UPDATE clause, the column value defaults to the current timestamp but does not update automatically.
4: If no default clause is used, but there is an on Update CURRENT_TIMESTAMP clause, the column defaults to 0 and is automatically updated.
5: If there is a constant value default, the column will have a default value and will not be automatically initialized to the current timestamp. If the column also has an ON Update CURRENT_TIMESTAMP clause, the timestamp is automatically updated, otherwise the column has a default constant but is not automatically updated.
In other words, you can use the current timestamp to initialize the value and update automatically, or either or none of them. (For example, you can specify automatic updates when you define them, but not initialize them.) )