mysql create_at 与更新时间之间的时间差

mysql time difference between create_at and updated at

我的 table created_at 和 updated_at 中有 2 列,想知道如果时间大于 20 秒,如何 return 区分?

如果列是 datetime 值,那么使用 timestampdiff 函数应该有效:

SELECT TIMESTAMPDIFF(SECOND,created_at,updated_at) AS diff_in_secs 
FROM table
WHERE TIMESTAMPDIFF(SECOND,created_at,updated_at) > 20;

Example.