Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 1
    My opinion: NOT NULL and CURRENT_TIMESTAMP as default value. But since I see you have columns named 'created_by' and 'updated_by', I suggest you to create a seperate table 'example_table_updates', containing the columns 'example_table_id', 'updated_by', and 'updated_at'. This way you could keep track when multiple users update the entry. Commented May 25, 2018 at 17:44
  • @JoeriShoeby that is a good suggestion. It also troubles me not using a default value for the fields, but that is another question, hehe. Now, about keeping track of the updates, on some instances we also have a complementary log table, but only when it is important =) Commented May 25, 2018 at 18:03
  • I think the main difference is that if the column is nullable, then you can't simply ORDER BY updated_at DESC to get a reverse chronological list of changes (i.e. new records + updates) as you might want to do on e.g. a homepage or dashboard. Commented Nov 6 at 17:19