mysql 经常使用函数

  • 日期 now()和sysdate()

在MySQL里now()和sysdate()函数都是表示取得当前时间,他们之间有什么区别mysql

SELECT NOW(),SYSDATE();
2015-12-13 09:13:23    2015-12-13 09:13:23

now()函数取的当前时间,取自mysql的一个变量”TIMESTAMP”,它取的时间是语句开始执行的那个时间,而且在语句执行过程当中,这个值都不会变。甚至于,你在执行一个存储过程或者触发器时,这个值都是一直不变的。
sysdate()是服务器的系统时间。
注意:
CURRENT_TIMESTAMP() LOCALTIME() LOCALTIMESTAMP()都是now()函数的同义词;
sysdate()没有同义词;
以为now()函数就够了,你不须要每次都取当前的机器系统时间,那么能够在MySQL启动时指定–sysdate-is-now,这样的话MySQL会把sysdate()当成now()的一个同义词。
sql


 

 

 

update budget_system_ecommerce_channel c left join sys_user u on u.id = c.operator_id set c.operator_id=u.login_name, c.operator_name = u.name where c.operator_id is not null
--处理旧数据 --使用逗号隔开
update budget_system_ecommerce_channel set operator_id= CONCAT(',', operator_id,',') where operator_id is not null;
update budget_system_ecommerce_channel set operator_name= CONCAT(',', operator_name,',') where operator_name is not null;
/*
select operator_name from budget_system_ecommerce_channel;
select CONCAT(',', operator_id,',') from budget_system_ecommerce_channel;
select operator_id from budget_system_ecommerce_channel where operator_id is not null;
*/服务器

相关文章
相关标签/搜索