国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 阿城市| 炉霍县| 南京市| 黎川县| 资阳市| 鄯善县| 汕头市| 隆回县| 江川县| 故城县| 青川县| 游戏| 察隅县| 蒙城县| 奉新县| 宁海县| 萍乡市| 泗洪县| 赞皇县| 彭阳县| 比如县| 临沭县| 游戏| 和平区| 乐平市| 闽清县| 诏安县| 界首市| 湛江市| 绵阳市| 商洛市| 新田县| 武鸣县| 上虞市| 霍城县| 赣榆县| 班戈县| 隆昌县| 重庆市| 海原县| 惠水县|