
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
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)
- Related Articles
- 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 do I avoid the variable value in a MySQL stored procedure to change when records are updated?
- How can I delete MySQL temporary table?
- How can I make a table in MySQL called “order”?
- 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?
- How can I tell if a string repeats itself in Python?
- 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 use MySQL INTERVAL() function with a column of a table?
- How can I see the CREATE TABLE statement of an existing MySQL table?
- Get Last Entry in a MySQL table?
- How can I create a MySQL stored procedure that returns multiple values from a MySQL table?

Advertisements