亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

使用SQL查詢所有數(shù)據(jù)庫名和表名問題

 更新時(shí)間:2022年11月22日 08:54:22   作者:思想永無止境  
這篇文章主要介紹了使用SQL查詢所有數(shù)據(jù)庫名和表名問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

MySQL中查詢所有數(shù)據(jù)庫名和表名

查詢所有數(shù)據(jù)庫

show databases;

查詢指定數(shù)據(jù)庫中所有表名

方法一、

use 數(shù)據(jù)庫名

show tables;

方法二、

select table_name from information_schema.tables where table_schema='數(shù)據(jù)庫名' and table_type='BASE TABLE';

查詢指定表中的所有字段名

select column_name from information_schema.columns where table_schema='數(shù)據(jù)庫名' and table_name='表名';

查詢指定表中的所有字段名和字段類型

show create table 表名;

或者

select column_name,data_type from information_schema.columns where table_schema='數(shù)據(jù)庫名' and table_name='表名';

SQLServer中查詢所有數(shù)據(jù)庫名和表名

查詢所有數(shù)據(jù)庫

select * from sysdatabases;

查詢當(dāng)前數(shù)據(jù)庫中所有表名

select * from sysobjects where xtype='U';
  • xtype='U':表示所有用戶表
  • xtype='S':表示所有系統(tǒng)表

查詢指定表中的所有字段名

select name from syscolumns where id=Object_Id('table_name');

查詢指定表中的所有字段名和字段類型

select sc.name,st.name from syscolumns sc,systypes st where sc.xtype=st.xtype and sc.id in(select id from sysobjects where xtype='U' and name='table_name');

Oracle中查詢所有數(shù)據(jù)庫名和表名

查詢所有數(shù)據(jù)庫

由于Oralce沒有庫名,只有表空間,所以O(shè)racle沒有提供數(shù)據(jù)庫名稱查詢支持,只提供了表空間名稱查詢。

select * from v$tablespace;--查詢表空間(需要一定權(quán)限)

查詢當(dāng)前數(shù)據(jù)庫中所有表名

select * from user_tables;

查詢指定表中的所有字段名

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

查詢指定表中的所有字段名和字段類型

select column_name, data_type from user_tab_columns where table_name = 'table_name';--表名要全大寫

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論