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