sql语句在MySQL获取数据库里的所有表名:
select table_name from information_schema.tables where table_schema='数据库名'
sql语句在MySQL获取数据库表的所有列名:
select column_name from information_schema.columns where table_schema='数据库名' and table_name='表名';
本文介绍如何使用SQL语句在MySQL中查询数据库的所有表名及特定表的所有列名,通过利用information_schema.tables和information_schema.columns视图,实现对数据库元数据的有效检索。
sql语句在MySQL获取数据库里的所有表名:
select table_name from information_schema.tables where table_schema='数据库名'
sql语句在MySQL获取数据库表的所有列名:
select column_name from information_schema.columns where table_schema='数据库名' and table_name='表名';

被折叠的 条评论
为什么被折叠?