查询数据库中所有的表名
直接使用下面的查询语句,“数据库名称”替换为你自己的“dbname”即可;
select table_name from information_schema.tables where table_schema='数据库名称' and table_type='base table';
查询指定数据库中指定表的所有字段名
直接使用下面的查询语句,“数据库名称”替换为你自己的“dbname”;
“表名”替换为你自己的“table_name”;
select column_name from information_schema.columns where table_schema='数据库名称' and table_name='表名'