通过使用带有 where 子句的 information_schema.tables 的列名“updated_time”,我们可以知道这一点。
让我们首先为我们的示例创建一个表。
mysql> create table myisamtabledemo -> ( -> id int -> );query ok, 0 rows affected (0.56 sec)
正在向表中插入一些记录。
mysql> insert into myisamtabledemo values(1);query ok, 1 row affected (0.72 sec)mysql> insert into myisamtabledemo values(2);query ok, 1 row affected (0.16 sec)
了解上次更新时间的语法。
select update_timefrom information_schema.tableswhere table_schema = 'yourdatabasename'and table_name = 'yourtablename';
让我们实现以下查询来获取上次更新时间。
mysql> select update_time -> from information_schema.tables -> where table_schema = 'business' -> and table_name = 'myisamtabledemo';
以下是输出。
+---------------------+| update_time |+---------------------+| 2018-11-01 19:00:02 |+---------------------+1 row in set (0.08 sec)
以上就是如何知道 mysql 表的最后更新时间?的详细内容。
