日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Oracle查询表结构的一些相关语句

發(fā)布時間:2025/4/5 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Oracle查询表结构的一些相关语句 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

2019獨角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>

?

select * from all_tab_comments; --查詢所有用戶的表、視圖等select * from user_tab_comments; --查詢當(dāng)前用戶的所有表、視圖等select * from all_col_comments; --查詢所有用戶的表的列名和注釋select * from user_col_comments; --查詢當(dāng)前用戶的表的列名和注釋select * from all_tab_columns; --查詢所有用戶的表的列的結(jié)構(gòu)信息(沒有備注)select * from user_tab_columns; --查詢當(dāng)前戶的表的列的結(jié)構(gòu)信息(沒有備注)

?

--查詢某張表的相信信息(包括列名、數(shù)據(jù)類型、長度、是否為空、是否主鍵、是否外鍵、備注) SELECT USER_TAB_COLS.COLUMN_NAME as 列名 , USER_TAB_COLS.DATA_TYPE as 數(shù)據(jù)類型, USER_TAB_COLS.DATA_LENGTH as 長度, USER_TAB_COLS.NULLABLE as 是否為空, case when (SELECT col.column_name FROM user_constraints con, user_cons_columns col where con.constraint_name = col.constraint_name and con.constraint_type='P' and col.table_name = '表名' and col.column_name = USER_TAB_COLS.COLUMN_NAME) = USER_TAB_COLS.COLUMN_NAME THEN 'Y' ELSE 'N' ENDas 是否主鍵, case when (select count(*) from user_constraints con, user_cons_columns col, (select t2.table_name,t2.column_name,t1.r_constraint_name from user_constraints t1,user_cons_columns t2 where t1.r_constraint_name=t2.constraint_name and t1.table_name='表名') r where con.constraint_name=col.constraint_name and con.r_constraint_name=r.r_constraint_name and con.table_name='表名' and col.column_name = USER_TAB_COLS.COLUMN_NAME) > 0 then 'Y' else 'N' END as 是否外鍵 , user_col_comments.comments as 備注 FROM USER_TAB_COLS inner join user_col_comments on user_col_comments.TABLE_NAME = USER_TAB_COLS.TABLE_NAME and user_col_comments.COLUMN_NAME=USER_TAB_COLS.COLUMN_NAME and USER_TAB_COLS.TABLE_NAME = '表名' ORDER BY USER_TAB_COLS.COLUMN_ID;

轉(zhuǎn)載于:https://my.oschina.net/lovedreamland/blog/34530

總結(jié)

以上是生活随笔為你收集整理的Oracle查询表结构的一些相关语句的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。