开发者

Listing MySQL tables and fields together

I know you can print all the tables in MySQL database using show tables; and all the fields in a table using describe ta开发者_如何学Goble; but is there a way of putting this together?

Thanks!


SELECT table_name, column_name, COLUMN_TYPE 
FROM information_schema.columns
WHERE TABLE_SCHEMA = 'my_db'
ORDER BY table_name, column_name

See: http://dev.mysql.com/doc/refman/5.0/en/columns-table.html
and: http://dev.mysql.com/doc/refman/5.0/en/information-schema.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜