1、查询mysql数据库所有的表名
SELECT TABLE_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '库名'
-- 例:
select table_name from information_schema.tables where table_schema='school-info'
2、获取mysql数据库表表头所有字段
SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '库名' AND TABLE_NAME = '表名'
-- 例:
SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'school-info' AND TABLE_NAME = 'students'