-- 查询某一库中所有表的名称,
SELECT
a.TABLE_SCHEMA
,a.TABLE_NAME
,a.TABLE_COMMENT
FROM
information_schema.TABLES
a
WHERE
a.table_type = 'BASE TABLE'
AND a.TABLE_SCHEMA = '<数据库名称>';
-- 查询库中某一张表中的所有字段
SELECT
a.TABLE_SCHEMA
,a.TABLE_NAME
,a.TABLE_COMMENT
,b.COLUMN_NAME
,b.COLUMN_TYPE
,b.COLUMN_COMMENT
FROM
information_schema.TABLES
a
LEFT JOIN information_schema.COLUMNS
b ON ( a.TABLE_SCHEMA = b.TABLE_SCHEMA AND a.TABLE_NAME = b.TABLE_NAME )
WHERE
a.table_type = 'BASE TABLE'
AND a.TABLE_SCHEMA = '<数据库名称>'
AND a.TABLE_NAME = '<表名称>';