日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

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

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

2019獨角獸企業重金招聘Python工程師標準>>>

?

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

?

--查詢某張表的相信信息(包括列名、數據類型、長度、是否為空、是否主鍵、是否外鍵、備注) SELECT USER_TAB_COLS.COLUMN_NAME as 列名 , USER_TAB_COLS.DATA_TYPE as 數據類型, 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;

轉載于:https://my.oschina.net/lovedreamland/blog/34530

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。