Jump to content

Timestamp Default Data


Recommended Posts

Dear all,


For an e.commerce project, I have the following for a carts table, which seem to be the practice in assigning date/time to such table:


`date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',


What are the merits in assigning default values as such for each date?

Link to comment
Share on other sites

You have to use a default value if you define the column as not null, but don't include those columns in the insert statement. You can allow null values in a column and then if you don't include them in the insert they will default to null. date_modified would make more sense to default to a null value instead of a point 2016 years ago.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...