information_schema.tables database table
information_schema.columns database table attributes
1. Get all tables in the database
select table_name as '表名',table_comment '描述'
from information_schema.tables
where table_schema='exchange' order by table_name desc;
2. Query all fields of the table
select column_name as '表名',column_name as '列名',data_type as '类型', column_comment as '标识'
from information_schema.columns
where table_schema = 'exchange' and table_name = 'contents';
3 , query the specified type of field
select column_name as '表名',column_name as '列名',data_type as '类型', column_comment as '标识'
from information_schema.columns
where table_schema = 'exchange' and table_name = 'contents' and DATA_TYPE in('varchar','longtext','text','char');