我有一个数据库“portal”和表“employee”,该表中的60多个字段没有按字母顺序排列。我想从phpmyadmin或任何其他方式按升序排列字段名称。
我尝试了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
......但它不起作用。
答案 0 :(得分:2)
您应该可以使用以下内容:
SELECT column_name
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_schema = 'portal'
AND table_name = 'employee'
ORDER BY column_name