Get the structure of a table through a query

1

Through PHPMyAdmin, by accessing a table, we can see the structure of the table in the structure tab that lists the fields, the types of data that each accepts, among other information.

How can I get through a query the details of a given table in the database, specifically the structure of the table, its fields, and the type of data that each field accepts?

    
asked by anonymous 11.03.2014 / 19:32

3 answers

1

This information can be obtained through information_schema

SELECT * FROM information_schema.columns WHERE table_name = 'nome_da_tabela'

abbreviated form:

describe nome_da_tabela
    
11.03.2014 / 19:37
2

Do this:

DESCRIBE tabela;

Or so:

SHOW CREATE TABLE tabela;
    
11.03.2014 / 19:36
2

If I understand it, it is DESCRIBE nome_da_tabela

ref: link

    
11.03.2014 / 19:39