1. 程式人生 > >達夢資料庫查詢表結構

達夢資料庫查詢表結構

因為客戶要求使用達夢資料庫,專案中又需要查詢表的結構,同事沒搞定,就交給我了。。。。  背鍋

查詢據說達夢跟Oracle資料庫的用法和形式都很像(暫時還不清楚他們倆究竟是什麼淵源),直接就按照Oracle的用法去查了,發現確實挺像。。。。

查詢表字段:

select * from user_tab_columns where Table_Name='TestDataBase';

查詢限制欄位:

select * from user_cons_columns where Table_Name='TestDataBase';

查詢限制欄位詳情:

select * from user_constraints where Table_Name='TestDataBase';

把這三個查詢出來的結果關聯起來就能獲取到對應的資料庫的表結構的資訊了