I want to get a list of all tables and their column names from MySQL (5.2).
At the moment I know that I can see all the table names by simply using:
show tables
Is there a simple extension to that query that would show me list of table names together with column names (I do not need types)? I am thinking of something like a join.
I think you are looking for INFORMATION_SCHEMA COLUMNS Table
SELECT TABLE_NAME, 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']
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.