假设有数据库studentdb、表student为例:
#mysql 查询studentdb数据库中共有多少个用户表
SELECT table_schema,table_name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'studentdb' and TABLE_TYPE='BASE TABLE'
#mysql查询studentdb数据库中student表的列名、数据类型、是否为空等属性。
select table_schema,table_name,column_name,data_type,is_nullable
from information_schema.columns WHERE TABLE_SCHEMA = 'studentdb' and TABLE_NAME='student'
order by table_schema,table_name