0

I want to be able to order the column names when I do a describe statement in SQL:

use <db_name>;
describe <table_name>;

What do I order it by?

use <db_name>;
describe <table_name> order by <????>;

Thanks.

makansij
  • 9,303
  • 37
  • 105
  • 183
  • Related, if it's of interest, I wrote a *Describe All Tables* in [this Answer](http://stackoverflow.com/a/38679580). One could modify it to do whatever ordering. Plus, as stated, it gets all tables. – Drew Jul 31 '16 at 00:45

1 Answers1

1

You cannot (easily) do this directly with MySQL, however, you can get the result with a simple shell wrapper:

mysql --e 'describe <table_name_goes_here>' --batch | sort -k 1

Sasha Pachev
  • 5,162
  • 3
  • 20
  • 20