开发者

Listing MySQL tables and fields together

开发者 https://www.devze.com 2023-04-07 15:30 出处:网络
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?

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

精彩评论

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