当前位置: 移动技术网 > IT编程>开发语言>c# > SQLserver、MySQL、ORCAL查询数据库、表、表中字段以及字段类型

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

2019年10月30日  | 移动技术网IT编程  | 我要评论

一、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='表名' and table_name='users'

 

 

 

 

、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';--表名要全大写

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网