国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開發(fā) > 綜合 > 正文

sql 查詢所有數(shù)據(jù)庫(kù)、表名、表字段總結(jié)

2024-07-21 02:47:47
字體:
供稿:網(wǎng)友
sql 查詢所有數(shù)據(jù)庫(kù)、表名、表字段總結(jié) Posted on 2015-01-28 15:57 JackieLaw 閱讀(...) 評(píng)論(...) 編輯 收藏ms sql server

1、查詢所有表select [id], [name] from [sysobjects] where [type] = 'u' order by [name]2、查詢所有數(shù)據(jù)庫(kù)3、select [name] from [sysdatabases] order by [name]查詢表中字段select [name] from [syscolumns] where [name] = 'tableXXX'order by [colid]

Oracle

1、查找表的所有索引(包括索引名,類型,構(gòu)成列):

select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name = i.table_name and t.table_name = 要查詢的表

2、查找表的主鍵(包括名稱,構(gòu)成列):

select cu.* from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'P' and au.table_name = 要查詢的表

3、查找表的唯一性約束(包括名稱,構(gòu)成列):

select column_name from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'U' and au.table_name = 要查詢的表

4、查找表的外鍵(包括名稱,引用表的表名和對(duì)應(yīng)的鍵名,下面是分成多步查詢):

select * from user_constraints c where c.constraint_type = 'R' and c.table_name = 要查詢的表

查詢外鍵約束的列名:

select * from user_cons_columns cl where cl.constraint_name = 外鍵名稱

查詢引用表的鍵的列名:

select * from user_cons_columns cl where cl.constraint_name = 外鍵引用表的鍵名

5、查詢表的所有列及其屬性

select t.*,c.COMMENTS from user_tab_columns t,user_col_comments c where t.table_name = c.table_name and t.column_name = c.column_name and t.table_name = 要查詢的表

6、查詢所有表select* from tabs


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 永川市| 翁牛特旗| 仪征市| 德江县| 建瓯市| 澜沧| 锦州市| 南平市| 新平| 冷水江市| 罗定市| 朝阳县| 长白| 昆山市| 三江| 阿尔山市| 馆陶县| 泌阳县| 乌鲁木齐市| 丽江市| 华池县| 巴彦淖尔市| 泽州县| 晋江市| 应用必备| 涡阳县| 马鞍山市| 湖州市| 潞城市| 饶阳县| 和田市| 如东县| 老河口市| 崇明县| 疏附县| 兴隆县| 寿阳县| 吉隆县| 道孚县| 澎湖县| 河北区|