oracle數(shù)據(jù)庫(kù)表信息查詢(xún)操作

隨機(jī)獲取oracle數(shù)據(jù)庫(kù)數(shù)據(jù)量
  // 從全表數(shù)據(jù)隨機(jī)抽取10%,獲取前10條數(shù)據(jù)
  select * from 表名 sample(10) where rownum > 10;
查看oracle數(shù)據(jù)庫(kù)的所有表
  select * from user_tables
查看某個(gè)表的字段和類(lèi)型,默認(rèn)值,字段注釋
 select 
   a.column_name,
   a.data_type,a.data_length,a.nullable,
   a.data_default,
   b.comments 
 from 
    user_tab_columns a,
    user_col_comments b 
 where 
    a.table_name = b.table_name 
 and 
    a.column_name = b.column_name 
 and 
    a.table_name = '表名'(表名要大寫(xiě))
查看某個(gè)表的主鍵
 select
   b.column_name
 from
   user_constraints a,
   user_cons_columns b
 where
   a.constraint_name=b.constraint_name 
 and 
   a.constraint_type='P'
 and 
    b.table_name='表名'(表名要大寫(xiě))
查看某個(gè)表的外鍵
 select * from user_constraints where constraint_type='R' and table_name = '表名'(表名要大寫(xiě))
查看某個(gè)表的前幾行數(shù)據(jù),在oracle沒(méi)有l(wèi)imit操作
 select * from 表名 where rownum < 行數(shù);
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容