根据数据库获取表名集合,根据表名获取字段信息

Oracle数据库:

1、根据数据库名字获取表的信息

SELECT table_name FROM user_tables Where user_tables.dropped='NO' Order by table_name

2、根据表名字获取字段信息

select table_name,column_name from user_tab_columns Where user_tab_columns.TABLE_NAME='表名'

mysql数据库:

1、根据数据库名字获取表信息

select TABLE_NAME from information_schema.`TABLES` t  where t.TABLE_SCHEMA='数据库名字' and TABLE_TYPE='BASE TABLE'

2、根据表名字获取字段信息

select COLUMN_NAME from information_schema.columns where TABLE_NAME='表名字'

原文地址:https://www.cnblogs.com/zyhblogs/p/2501096.html