user1383088
user1383088

Reputation:

Arrange fields of table in database in alphabetical order

I have a database "portal" and table "employee" and more than 60 fields in that table not arranged in alphabetical order. I want to arrange the fields name in ascending order from phpmyadmin or by any other means.

I tried MySQL sorting table by column names

SELECT column_name
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_schema = '[portal]'
AND table_name = '[employee]'
ORDER BY column_name

...but it doesn't work.

Upvotes: 0

Views: 808

Answers (1)

Taryn
Taryn

Reputation: 247860

You should be able to use the following:

SELECT column_name
FROM INFORMATION_SCHEMA.COLUMNS
WHERE  table_schema = 'portal'
   AND table_name = 'employee'
ORDER BY column_name

Upvotes: 1

Related Questions