本文介绍了MySQL:如何获取最后一次插入数据库的时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
无论我插入的数据库表如何,如何检查我上次在数据库中写入的时间(时间戳)?
How can I check when was the last time (timestamp) that I wrote in the database, irrespectively of the database table that I inserted into?
推荐答案
原来不是答案(不能删除为已接受).请参阅此答案下方的评论.
Turned out to not be the answer (can't delete as accepted). See comments below this answer.
我无法使用information_schema.tables update_time
,因为该列没有被更新,但是对于create_time
却可以.如果update_time
得到更新,这对于update_time
(如果已更改)将起作用,这在您的设置中可能是正确的.
I wasn't able to use information_schema.tables update_time
as the column wasn't being updated but for create_time
this worked. It would work for update_time
(if changed) if update_time
gets updated which might be true in your setup.
select table_schema,table_name,max_time from information_schema.tables t1 JOIN
(select MAX(t2.create_time) AS max_time FROM
information_schema.tables t2 where
table_schema ='test') as t3
on t1.create_time = t3.max_time;
这篇关于MySQL:如何获取最后一次插入数据库的时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!