标签:div 修改 test efault nbsp https alter l数据库 内容
修改过mysql数据库字段内容默认值为当前时间 --添加CreateTime 设置默认时间 CURRENT_TIMESTAMP ALTER TABLE `table_name` ADD COLUMN `CreateTime` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间‘ ; https://www.cnblogs.com/testway/p/5531969.html
--修改CreateTime 设置默认时间 CURRENT_TIMESTAMP ALTER TABLE `table_name` MODIFY COLUMN `CreateTime` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间‘ ; --添加UpdateTime 设置 默认时间 CURRENT_TIMESTAMP 设置更新时间为 ON UPDATE CURRENT_TIMESTAMP ALTER TABLE `table_name` ADD COLUMN `UpdateTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ‘创建时间‘ ; --修改 UpdateTime 设置 默认时间 CURRENT_TIMESTAMP 设置更新时间为 ON UPDATE CURRENT_TIMESTAMP ALTER TABLE `table_name` MODIFY COLUMN `UpdateTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMPCOMMENT ‘创建时间‘ ;
更新一个表中的某个字段值等于另一个表的某个字段值:
update a inner join b on a.bid=b.id set a.x=b.x,a.y=b.y ;
标签:div 修改 test efault nbsp https alter l数据库 内容
原文地址:https://www.cnblogs.com/hahajava/p/10086887.html