【正文】
varchar2(30) constraint varchar2(30)sqlalter table cz add constraint cz_unique unique(c1,c10,c20) exceptions into exceptions。創(chuàng)建該表的 sql 腳本文件為 。 (再將臨時表test里的內(nèi)容反插回來)(4).適用于有大量重復(fù)記錄的情況(exception into 子句法):采用alter table 命令中的 exception into 子句也能確定出庫表中重復(fù)的記錄。 (建一個臨時表test用來存放重復(fù)的記錄)sqltruncate table cz。sqldelete from cz a where rowid (select max(rowid) from cz where c1= and c10= and c20=)。(2).適用于有少量重復(fù)記錄的情況(注意,對于有大量重復(fù)記錄的情況,用以下語句效率會非常低):sqldelete from cz a where !=(select max(rowid) from cz b where = and = and =)。 c1 c10 c20 1 2 dsf 2 3 che 3 4 dff:(1).適用于有大量重復(fù)記錄的情況(在c1,c10和c20列上建有索引的時候,用以下語句效率會非常高):sqldelete cz where (c1,c10,c20) in (select c1,c10,c20 from cz group by c1,c10,c20 having count(*)1) and rowid not in(select min(rowid) from cz group by c1,c10,c20 having count(*)1)。 c1 c10 c20 1 2 dsf 2 3 che 3 4 dff(2).sq