Moose
Moose

Reputation: 630

Chronological listing of tables in MySQL database

While using phpMyAdmin I noticed suddenly that the table I frequently used had shifted to a different page, it used to be on page 2 where now it is on page 3. I'm the only one working on this database and find this quite peculiar.

There are quite a number of tables in this database so one or two new ones aren't going to stand out to me.

Is there somehow I can list the tables in this database in chronological order of being added?

Upvotes: 1

Views: 85

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522094

Your (and my) first inclination might be to use SHOW TABLES, but alas there does not appear to be a way to do an ORDER BY, q.v. the official MySQL documentation. However, you can query information_schema.tables and order by the update_time:

SELECT table_name
FROM information_schema.tables 
WHERE table_schema = 'db_name'
ORDER BY update_time DESC;

The above query will give you all tables in the db_name database sorted with the most recent first.

Upvotes: 1

Related Questions