按desc表排序

时间:2012-03-02 06:07:46

标签: mysql sql

我有一个包含大约100列的大表,因此在使用desc tablename时很难找到列。

我在描述表格时可以order by desc users order by something

desc users的输出有Field | Type,因为列标题Field有列名,所以我想做desc users order by Field之类的事情。这有什么用吗?

2 个答案:

答案 0 :(得分:1)

您想使用ANSI INFORMATION_SCHEMA:

SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT
  FROM INFORMATION_SCHEMA.COLUMNS
 WHERE table_name = 'tbl_name'
  [AND table_schema = 'db_name']
  [AND column_name LIKE 'wild']
ORDER BY COLUMN_NAME

参考:

答案 1 :(得分:0)

order by users,something desc