1. 程式人生 > >mysql 獲取已知資料庫的表名和表結構

mysql 獲取已知資料庫的表名和表結構

1、獲取資料庫test中的表名

select table_name from information_schema.tables where table_schema='test' and table_type='base table';

2、獲取資料庫test中表miscinfo的表結構:name, type, key
select column_name,COLUMN_TYPE,COLUMN_KEY from information_schema.columns where table_schema='test' and table_name='miscinfo'