How to get table column names in mysql

Published on Author bloggerfiveLeave a comment

Way 1
=====

The following syntax used to shows field name ,datatype with all constraints .

SHOW COLUMNS FROM table_name FROM database;

Way 2
=====

In this case , it shows the column name with ascending order .

SELECT column_name
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = ‘table_name’
AND table_schema = ‘database’    

ORDER BY column_name;

Comments

comments

Leave a Reply

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