Get just the fields names of a table in MySQL

If you do:

describe `table_name`

Mysql will give you table information which will contain field names, their types, etc. What if you want just the field names and nothing else? You can run this query and do just that:

SELECT column_name
WHERE table_name = 'tablename'
AND   table_schema = 'dbname';

By Moazzam

Moazzam is a software developer working in the big apple. He has over a decade of experience in development. While most of his work involves developing web applications, he does development for Android and Windows Mobile in his spare time.

Leave a Reply

Your email address will not be published. Required fields are marked *