Oracle,Mysql 获取用户下所有表名,获取表所有的列名及数据类型

Mysql

下面是mysql获取数据库所有表的语句
select table_name from information_schema.TABLES where TABLE_SCHEMA='Username'

information_schema这个是数据系统用来保存数据表的总表
select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables where table_schema = (select database())
拿到表之后,可以获取表的所有字段。

select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra from information_schema.columns
        where table_name = 'tablename' and table_schema = (select database()) order by ordinal_position

Oracle

获取用户所有表
select table_name from user_tables where TABLESPACE_NAME is not null and  user='UserName' 

获取表字段 SELECT table_name, column_name, data_type FROM all_tab_cols WHERE table_name = 'tablename '