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 '

 

相关文章:

  • 2022-12-23
  • 2021-10-25
  • 2022-01-01
  • 2021-12-15
  • 2021-11-07
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
猜你喜欢
  • 2021-10-13
  • 2022-12-23
  • 2021-09-28
  • 2022-12-23
  • 2021-12-26
  • 2022-01-11
相关资源
相似解决方案