最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

使用SQL語(yǔ)句查詢(xún)MySQL,SQLServer,Oracle所有數(shù)據(jù)庫(kù)名和表名,字段名

 更新時(shí)間:2018年03月20日 17:41:28   投稿:wdc  
本文例出了使用SQL語(yǔ)句查詢(xún)MySQL,SQLServer,Oracle所有數(shù)據(jù)庫(kù)名和表名的SQL語(yǔ)句,有需要的可以參考下

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

查詢(xún)所有數(shù)據(jù)庫(kù)

show databases;


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

select table_name from information_schema.tables where table_schema='database_name' and table_type='base table';


查詢(xún)指定表中的所有字段名

select column_name from information_schema.columns where table_schema='database_name' and table_name='table_name';


查詢(xún)指定表中的所有字段名和字段類(lèi)型

select column_name,data_type from information_schema.columns where table_schema='database_name' and table_name='table_name';


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

查詢(xún)所有數(shù)據(jù)庫(kù)

select * from sysdatabases;


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

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


查詢(xún)指定表中的所有字段名

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


查詢(xún)指定表中的所有字段名和字段類(lèi)型

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中查詢(xún)所有數(shù)據(jù)庫(kù)名和表名

查詢(xún)所有數(shù)據(jù)庫(kù)

由于Oralce沒(méi)有庫(kù)名,只有表空間,所以O(shè)racle沒(méi)有提供數(shù)據(jù)庫(kù)名稱(chēng)查詢(xún)支持,只提供了表空間名稱(chēng)查詢(xún)。

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


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

select * from user_tables;


查詢(xún)指定表中的所有字段名

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


查詢(xún)指定表中的所有字段名和字段類(lèi)型

select column_name, data_type from user_tab_columns where table_name = 'table_name';-

使用SQL語(yǔ)句查詢(xún)MySQL,SQLServer,Oracle所有數(shù)據(jù)庫(kù)名和表名,字段名的SQL語(yǔ)句,簡(jiǎn)單明了

相關(guān)文章

最新評(píng)論

徐闻县| 阿拉善右旗| 滦平县| 鹤山市| 楚雄市| 北流市| 丰台区| 合水县| 昌宁县| 文登市| 上思县| 宁化县| 大庆市| 墨竹工卡县| 广平县| 四子王旗| 达尔| 资中县| 丹阳市| 车致| 富平县| 平阴县| 招远市| 竹北市| 重庆市| 锡林郭勒盟| 西吉县| 墨竹工卡县| 星子县| 贵南县| 南雄市| 通辽市| 平度市| 万盛区| 嘉峪关市| 济宁市| 黑河市| 团风县| 南江县| 巍山| 海丰县|