Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display all the tables with more information (create date, size,...) in a MySQL database?

Tags:

sql

mysql

Searched and searched and gave up. All I want is more info on a MySQL table or better yet, a list of all tables in a MySQL database in the descending/ascending order of their create date.

Something like this :

SHOW TABLES FROM MyDB ORDER BY CREATE_DATE;

Donnie's answer did the trick :

select * from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = 'DBName' order by create_time desc;
like image 976
ThinkCode Avatar asked Nov 16 '10 17:11

ThinkCode


People also ask

How do I display the entire content of a table in MySQL?

The first command you will need to use is the SELECT FROM MySQL statement that has the following syntax: SELECT * FROM table_name; This is a basic MySQL query which will tell the script to select all the records from the table_name table.

How can I check data table size in MySQL?

To check the sizes of all of your databases, at the mysql> prompt type the following command: Copy SELECT table_schema AS "Database", ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)" FROM information_schema.

Which command is used to show all the tables in MySQL?

Show MySQL Tables from the Command Line To get information about the tables from the Linux shell, you can use either the mysql -e command or the mysqlshow command that displays databases and tables information.


1 Answers

INFORMATION_SCHEMA.TABLES is the most easily queryable, but that doesn't have creation date. show table status does return creation date information. You can probably craft something to get the table name out of information_schema, then call show table status on each.

like image 70
Donnie Avatar answered Oct 22 '22 13:10

Donnie