查询所有库名
show databases;
SELECT distinct(TABLE_SCHEMA) dbname FROM information_schema.TABLES
查询所有表名
SELECT table_name,`engine` from information_schema.tables where table_schema='dbname' and table_type='base table'
查询表是否存在
SHOW TABLES LIKE '%tb_bp_d_case%';
select TABLE_NAME from INFORMATION_SCHEMA.TABLES whereTABLE_SCHEMA='dbname' and TABLE_NAME='tablename' ;
查询表的所有字段
select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_name='tp_papers' and table_schema='gb_activity_2020' ORDER BY ORDINAL_POSITION