oracle 查詢有主鍵的表的方法

2021-05-09 12:05:50 字數 357 閱讀 2962

select   distinct b.table_name  from   all_cons_columns   a,all_constraints   b    

where   a.constraint_name   =   b.constraint_name     and   constraint_type   =   'p' and a.owner='itil_sj'

constraint_type   =   'p'   鍵的型別

owner  資料庫使用者名稱

constraint_name  約束名

可以參照帖子:http://topic.csdn.net/t/20010827/10/257938.html

查詢沒有主鍵的表 沒有索引的表

1 查詢沒有主鍵的表 沒有索引的表 select so.name as 沒有主鍵的表 from sysobjects so where so.xtype u and objectproperty so.id tablehasprimarykey 0 order by name select so.n...

OGG 測試有主鍵表和無主鍵表的同步情況

環境說明 ogg 版本11.2.1.0.1,源端test,有主鍵,test3表無主鍵,目標端的trail檔案未被刪除。sql insert into test3 values 1,test 1 row created.sql insert into test3 values 1,test 1 row...

Sql Server 刪除表中沒有主鍵的重複資料

資料庫中的資料在很多情況下是從excel中匯入的,這就難免有些重複的資料,然而這些資料又沒有主鍵,那麼該如何去重呢?有一張資料如下的表 嘗試了很多方法,覺得有一種比較實用,步驟比較簡單 用distinct關鍵字查詢出不重複的資料後,將資料寫入虛擬表中,刪除原表,讀取虛擬表資料,寫回原表,請看 sel...