有没有一种快速的方法可以从MySQL
中的所有表中获取所有列名,而不必列出所有表?
发布于 2011-04-13 19:50:33
select * from information_schema.columns
where table_schema = 'your_db'
order by table_name,ordinal_position
发布于 2012-11-22 13:49:06
要列出MySQL中表中的所有字段,请执行以下操作:
select *
from information_schema.columns
where table_schema = 'your_DB_name'
and table_name = 'Your_tablename'
发布于 2015-06-10 21:56:46
SELECT * FROM information_schema.columns
WHERE table_schema = DATABASE()
ORDER BY table_name, ordinal_position
由于我没有足够的代表来发表评论,这里有一个(在我看来)对nick rulez的优秀答案的小改进:用WHERE table_schema = DATABASE()
替换WHERE table_schema = 'your_db'
。
https://stackoverflow.com/questions/5648420
复制相似问题