使用SQL語句查詢MySQL,SQLServer,Oracle所有數(shù)據(jù)庫名和表名,字段名
MySQL中查詢所有數(shù)據(jù)庫名和表名
查詢所有數(shù)據(jù)庫
show databases;
查詢指定數(shù)據(jù)庫中所有表名
select table_name from information_schema.tables where table_schema='database_name' and table_type='base table';
查詢指定表中的所有字段名
select column_name from information_schema.columns where table_schema='database_name' and table_name='table_name';
查詢指定表中的所有字段名和字段類型
select column_name,data_type from information_schema.columns where table_schema='database_name' and table_name='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';-
使用SQL語句查詢MySQL,SQLServer,Oracle所有數(shù)據(jù)庫名和表名,字段名的SQL語句,簡單明了
相關(guān)文章
ORACLE 系統(tǒng)函數(shù)大全SQLSERVER系統(tǒng)函數(shù)的異同
下面是Oracle支持的字符函數(shù)和它們的Microsoft SQL Server等價(jià)函數(shù)。2009-07-07
SQL基礎(chǔ)教程之行轉(zhuǎn)列Pivot函數(shù)
這篇文章主要給大家介紹了關(guān)于SQL基礎(chǔ)教程之行轉(zhuǎn)列Pivot函數(shù)的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用SQL具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-09-09
本機(jī)上實(shí)現(xiàn)neo4j遠(yuǎn)程連接方式
這篇文章主要介紹了本機(jī)上實(shí)現(xiàn)neo4j遠(yuǎn)程連接方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-02-02
Linux下開啟和配置OpenGauss數(shù)據(jù)庫遠(yuǎn)程連接的教程詳解
openGauss是一款開源關(guān)系型數(shù)據(jù)庫管理系統(tǒng),采用木蘭寬松許可證v2發(fā)行,本文主要為大家介紹了Linux系統(tǒng)中如何開啟和配置OpenGauss數(shù)據(jù)庫的遠(yuǎn)程連接,需要的小伙伴可以參考下2023-12-12

