How to select the name of a column in MySQL?

1

How to get the name of a column in MySQL even though it has no rows?

    
asked by anonymous 11.07.2017 / 21:45

1 answer

2
show columns from nome_da_tabela

This is a simple form, this query returns six fields field (what matters to you), type , null , key , default and extra .

For more information, use information_schema.columns

SELECT * FROM information_schema.columns WHERE table_name = 'nome_da_tabela'
    
11.07.2017 / 21:49