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
精彩评论