- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I tell when a MySQL table was last updated?
152 Lectures 16 hours
87 Lectures 5.5 hours
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)
- MySQL Error ERROR 1099 (HY000): Table was locked with a READ lock and can't be updated
- How can I tell if table row is in view using jQuery?
- How can I tell if a string repeats itself in Python?
- How can I delete MySQL temporary table?
- How do I avoid the variable value in a MySQL stored procedure to change when records are updated?
- How can I change the storage engine of a MySQL table?
- How can I drop an existing column from a MySQL table?
- How can I remove every column in a table in MySQL?
- Get Last Entry in a MySQL table?
- How can I use MySQL subquery as a table in FROM clause?
- How can I loop through all rows of a table in MySQL?
- How can I make a table in MySQL called “order”?
- How can I use MySQL INTERVAL() function with a column of a table?
- How can I see the CREATE TABLE statement of an existing MySQL table?
- How can I create a MySQL stored procedure that returns multiple values from a MySQL table?