Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I describe all tables in the database through one statement?

Tags:

mysql

Is there any statement that can describe all tables in a database?

Something like this:

describe * from myDB; 
like image 281
Sajad Avatar asked Nov 16 '13 16:11

Sajad


People also ask

Which statement is used to list all the tables in a database?

1 Answer. SHOW TABLES; command is used to view the list of tables in a database.

What is the command to display all table names in one database?

INFORMATION_SCHEMA.TABLES view allows you to get information about all tables and views within a database.


2 Answers

There is no statement that describe all tables at once. But you may want to do something like this :

SELECT * FROM information_schema.columns WHERE table_schema = 'db_name'; 
like image 189
Hamed Kamrava Avatar answered Sep 28 '22 10:09

Hamed Kamrava


because the other suggestions made very much mess on the screen or just did not do the trick here is a hack for a small db:

describe table_a; describe table_b; describe table_c;  

and so on

like image 33
sivi Avatar answered Sep 28 '22 11:09

sivi