SYSDATE() vs NOW() in MySQL
SYSDATE()returns the time at which it executes. 返回实际的执行时间。NOW()returns a constant time that indicates the time at which the statement began to execute. 返回这个语句开始执行的时间。- The
SET TIMESTAMPstatement affects the value returned byNOW()but not bySYSDATE().
SET TIMESTAMP 会影响 NOW() 的值但是不会影响 SYSDATE()。
SELECT
SYSDATE(), SLEEP(1) AS '', SYSDATE(),
NOW(), SLEEP(1) AS '', NOW();
将SYSDATE()作为NOW()的别名
为了防止两者的差异造成的bug,将SYSDATE()作为NOW()的别名 : 使用-sysdate-is-now 关键字参数。

浙公网安备 33010602011771号