--修改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 ;
mysql 常用sql
标签:div 修改 test efault nbsp https alter l数据库 内容