Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
How can I tell when a MySQL table was last updated?
We can know that with the help of the column name ?UPDATED_TIME? using information_schema.tables with WHERE clause.
Let us 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 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)
Syntax to know the last updated time.
SELECT UPDATE_TIME FROM information_schema.tables WHERE TABLE_SCHEMA = 'yourDatabaseName' AND TABLE_NAME = 'yourTableName';
Let us implement the following query to get the last updated 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)
Advertisements
