When using MySQL 5.5, this leads to an error when adding length to the datetime, so for this you have to write
REATE TABLE IF NOT EXISTS `blogs` ( `blog_id` int(10) NOT NULL AUTO_INCREMENT, `blog_title` text NOT NULL, `blog_content` text NOT NULL, `created_on` datetime(6) NOT NULL, `created_by` int(20) NOT NULL, `updated_on` datetime(6) NOT NULL, `updated_by` int(20) NOT NULL, PRIMARY KEY (`blog_id`) ) Engine=InnoDB AUTO_INCREMENT=14 ;
This, however, will work when using MySQL 5.6.
It will not add length to the datetime , but MySQL 5.6 will ignore the length and execute it as a normal datetime field.
source share