Is it possible to query a MySQL database to get the column names of a table in alphabetical order? I know that
SHOW COLUMNS `table_name`;
If you want more details, below query is really handy:
SELECT COLUMN_NAME as 'Field',
COLUMN_TYPE as 'Type',
IS_NULLABLE as 'Null',
COLUMN_KEY as 'Key',
COLUMN_DEFAULT as 'Default',
EXTRA as 'Extra'
from INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME = 'my table' and
TABLE_SCHEMA = 'my database'
add ordering
order by Type; --