dps dps - 1 month ago 6
MySQL Question

Can you sort the output of SHOW COLUMNS or DESC?

Is it possible to (easily) sort the output of the SHOW COLUMNS or DESC MySQL Command?

Answer

you can sort the table names using order by but you have to select the column names from the information_schema below is the column names in alphabetical order

SELECT column_name
FROM information_schema.columns
WHERE table_name = 'table_name' ORDER BY column_name