SQLserver、MySQL、ORCAL查询数据库、表、表中字段以及字段类型


一、SQLServer命令

       1、查询SQLServer中的每个数据库

SELECT * from sysdatabases

         

       2、查询SQLServer中指定数据库的所有表名         

  select name from CFS.. sysobjects where  xtype='u'   #注意:CFS 是数据库名称

 

3、查询表中的字段以及字段类型

 select COLUMN_name as name,data_type as type
 from INFORMATION_SCHEMA.COLUMNS
 where table_name = '表名'

 

  二、MySQL命令

     1、查询MySQL中的每个数据库   

show DATABASES

 

       2、查询MySQL中指定数据库的所有表名       

select table_name as name
 from information_schema.tables
where table_schema = '数据库名' and table_type = 'base table'

 

       3、查询表中的字段以及字段类型

select COLUMN_NAME as name,DATA_TYPE as type from information_schema.columns where table_schema='表名'

 

、ORCAL命令

     1、查询ORCAL中的每个数据库

     select * from v$tablespace

 

      2、查询ORCAL中指定数据库的所有表名       

select * from user_tables;

 

     3、查询表中的字段以及字段类型

select column_name from user_tab_columns where table_name = 'table_name';--表名要全大写

参考网址1: https://www.cnblogs.com/lonelyxmas/p/10577287.html

参考网址2: https://www.jb51.net/article/136787.htm


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM