mysql 中 insert 大量数据 避免时间戳相同 !!

Posted on 2022-07-05 15:30  o0o0o9  阅读(501)  评论(0编辑  收藏  举报

时间函数 now() current_timestamp() 和 sysdate() 

CURRENT_TIMESTAMP and CURRENT_TIMESTAMP() are synonyms for NOW().

也就是说 CURRENT_TIMESTAMP和 CURRENT_TIMESTAMP()都是 NOW()这个函数的同义词,所以作用相同,

 

 

而sysdate()函数的解释是

SYSDATE() returns the time at which it executes. This differs from the behavior for NOW(), which returns a constant time that indicates the time at which the statement began to execute. (Within a stored function or trigger, NOW() returns the time at which the function or triggering statement began to execute.)

简单来说,now()current_timestamp())函数获得的是语句开始执行时的时间,而sysdate()函数是这个函数执行时候的时间。

 

 

所以 Insert into tablea  (a,b,c,inserttime) select a,b,c,sysdate(3) from tableb

Copyright © 2024 o0o0o9
Powered by .NET 9.0 on Kubernetes