MySQL auto-store datetime for each row
问题 In MySQL, I'm sick of adding the columns dt_created and dt_modified (which are date time stamps for creation and last modified respectively) to all the tables I have in my database. Every time I INSERT or UPDATE the database, I will have to use the NOW() keyword. This is going all over my persistence. Is there any efficient alternative where MySQL can automatically store at least the datatime of the row that is inserted and let me retrieve it? 回答1: You can use DEFAULT constraints to set the