一、清除資料需要的步驟:
1複製原本的資料到另一表(此步需要對資料進行過濾,以去除重複資料)
2將原表資料刪除
3將另一表資料插入原表
需要注意主鍵是否需要改變,如果需要改變,主鍵需要sys_guid()來建立
----清除user重複資料----
--複製表結構
create
table user4copy as
(select
*from
user
where1=
2);--向複製表中插入過濾後的資料, 根據 usercode 過濾資料
insert
into user4copy
select usercode,
max(userid)
,max
(username)
,max
(isstop)
from
user
group
by usercode;
--刪除原表的資料
delete
user
;--向原表插入過濾後資料
insert
into
user
select
*from user4copy;
----清除user重複資料----
清除oracle表中的重複資料
水貼,紀念因為我的電腦進水強制關機而犧牲掉的第一稿 本文提到採用select distinct from table 匯入匯出表資料的方式來時現清除oracle表中的重複資料,效能還是可觀的。備份要操作的表a,提高容錯性 create table b as select from atruncate...
oracle去掉表重複資料
今天在做專案過程中,碰到資料庫表存在重覆記錄,顯示的時候需要去掉重複的資料。想了老半天,最終用rank over partition by 分組字段 order by 排序字段 順序 解決了此問題。一 首先介紹下rank over partition by 分組字段 order by 排序字段 順序...
Oracle刪除表中重複資料
1.建立臨時表 備份全部資料到 create table tmap.t comm customer col log 731all as select from tmap.t comm customer col log 2.建立臨時表 備份資料 去除重複項 create table tmap.t co...