createtableMyISAMTableDemo ->( ->idint ->);QueryOK,0rowsaffected(0.56sec) is inserting some records into the table. mysql>insertintoMyISAMTableDemovalues(1);QueryOK,1rowaffe"/> createtableMyISAMTableDemo ->( ->idint ->);QueryOK,0rowsaffected(0.56sec) is inserting some records into the table. mysql>insertintoMyISAMTableDemovalues(1);QueryOK,1rowaffe">
Home >Database >Mysql Tutorial >How to know when a MySQL table was last updated?
We can know this by using the column name "UPDATED_TIME" of information_schema.tables with a WHERE clause.
Let's first create a table for our example.
mysql> create table MyISAMTableDemo -> ( -> id int -> ); Query OK, 0 rows affected (0.56 sec)
Inserting some records into the table.
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)
Understand the syntax of last updated time.
SELECT UPDATE_TIME FROM information_schema.tables WHERE TABLE_SCHEMA = 'yourDatabaseName' AND TABLE_NAME = 'yourTableName';
Let's implement the following query to get the last update time.
mysql> SELECT UPDATE_TIME -> FROM information_schema.tables -> WHERE TABLE_SCHEMA = 'business' -> AND TABLE_NAME = 'MyISAMTableDemo';
The following is the output.
+---------------------+ | UPDATE_TIME | +---------------------+ | 2018-11-01 19:00:02 | +---------------------+ 1 row in set (0.08 sec)
The above is the detailed content of How to know when a MySQL table was last updated?. For more information, please follow other related articles on the PHP Chinese website!