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

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

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

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)文章

最新評論

阳新县| 营山县| 鹿泉市| 西乡县| 惠来县| 库尔勒市| 南宫市| 政和县| 甘洛县| 嵊州市| 台湾省| 东乡| 新泰市| 巴林右旗| 右玉县| 青海省| 通城县| 遂溪县| 赞皇县| 肇庆市| 河曲县| 赤水市| 阜新市| 灵宝市| 西城区| 兴和县| 滁州市| 依兰县| 眉山市| 丰城市| 海丰县| 辽中县| 通道| 化隆| 右玉县| 陆河县| 沙坪坝区| 米林县| 广南县| 新田县| 镇平县|