使用SQL語(yǔ)句查詢MySQL,SQLServer,Oracle所有數(shù)據(jù)庫(kù)名和表名,字段名
MySQL中查詢所有數(shù)據(jù)庫(kù)名和表名
查詢所有數(shù)據(jù)庫(kù)
show databases;
查詢指定數(shù)據(jù)庫(kù)中所有表名
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ù)庫(kù)名和表名
查詢所有數(shù)據(jù)庫(kù)
select * from sysdatabases;
查詢當(dāng)前數(shù)據(jù)庫(kù)中所有表名
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ù)庫(kù)名和表名
查詢所有數(shù)據(jù)庫(kù)
由于Oralce沒有庫(kù)名,只有表空間,所以O(shè)racle沒有提供數(shù)據(jù)庫(kù)名稱查詢支持,只提供了表空間名稱查詢。
select * from v$tablespace;--查詢表空間(需要一定權(quán)限)
查詢當(dāng)前數(shù)據(jù)庫(kù)中所有表名
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語(yǔ)句查詢MySQL,SQLServer,Oracle所有數(shù)據(jù)庫(kù)名和表名,字段名的SQL語(yǔ)句,簡(jiǎn)單明了
相關(guān)文章
在CRUD操作中與業(yè)務(wù)無(wú)關(guān)的SQL字段賦值的方法
這篇文章主要介紹了在CRUD操作中與業(yè)務(wù)無(wú)關(guān)的SQL字段賦值的方法的相關(guān)資料,需要的朋友可以參考下2016-04-04多種獲取遠(yuǎn)程連接access數(shù)據(jù)庫(kù)的方法
多種獲取遠(yuǎn)程連接access數(shù)據(jù)庫(kù)的方法...2007-03-03JetBrains DataGrip安裝和使用的詳細(xì)教程
日常開發(fā)中少不了各種可視化數(shù)據(jù)庫(kù)管理工具。本文介紹另一個(gè)十分好用且強(qiáng)大的工具:DataGrip。具有一定的參考價(jià)值,感興趣的可以了解一下2021-09-09在PostgreSQL的基礎(chǔ)上創(chuàng)建一個(gè)MongoDB的副本的教程
這篇文章主要介紹了在PostgreSQL的基礎(chǔ)上創(chuàng)建一個(gè)MongoDB的副本的教程,使在使用NoSQL的同時(shí)又能用到PostgreSQL中的東西,需要的朋友可以參考下2015-04-04經(jīng)常使用的JDBC連接數(shù)據(jù)庫(kù)方式
在我們開發(fā)中,幾乎脫離不了連接數(shù)據(jù)庫(kù)。并且無(wú)論是使用框架還是硬編碼連接數(shù)據(jù)庫(kù),都避免不了寫驅(qū)動(dòng)類以及連接url。為了方便我們的開發(fā),我們收藏常用的jdbc連接數(shù)據(jù)庫(kù)方式。2013-04-04從Bak文件中恢復(fù)SQL數(shù)據(jù)庫(kù)的三種方法
在數(shù)據(jù)庫(kù)管理和維護(hù)過程中,數(shù)據(jù)的安全性和完整性至關(guān)重要,備份文件(.bak 文件)是 SQL Server 中常用的數(shù)據(jù)庫(kù)備份格式,本文將介紹從 .bak 文件恢復(fù) SQL 數(shù)據(jù)庫(kù)的基本步驟和最佳實(shí)踐,需要的朋友可以參考下2024-09-09