In this post, I provide a small demo to set default value for a Datatime column in MySQL.
I know this very basic topic and nothing special about this, but I am writing here because this is one of the most questioned by MySQL Beginner.
I always try to target all kind of database professional.
Following is a small demonstration of this.
First, Create table with default:
CREATE TABLE TestDefault
,MyDate DATETIME DEFAULT CURRENT_TIMESTAMP
Second, Insert a test record:
INSERT INTO TestDefault(Name) VALUES ('Anvesh')
Check the result:
SELECT * FROM TestDefault
Name | MyDate
Anvesh | 2015-10-25 17:47:50
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.