我有一个包含大约100列的大表,因此在使用desc tablename
时很难找到列。
我在描述表格时可以order by
desc users order by something
?
desc users
的输出有Field | Type
,因为列标题Field
有列名,所以我想做desc users order by Field
之类的事情。这有什么用吗?
答案 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