Mysql – Automatically add core fields to a table when created

MySQLtimestamptrigger

I was reading these articles on StackOverflow regarding triggers and created date and updated date in mysql, and was wondering whether it is possible to create a trigger that checks if these two fields are present in the create table statement, and either creates the relevant trigger, or creates the fields, as well as the trigger? I am aware that there will be some tables for which this is not relevant, but I will address that in the future.

What is the best way to set up last-modified and date-record-added fields?

adding column to all tables in a mysql database (unknown table names)

Best Answer

The feature you are asking for is called "DDL triggers".

And no, MySQL doesn't have that. So you can't do this in a trigger.