本文共 1988 字,大约阅读时间需要 6 分钟。
? Oracle ????????????????? SQL ?????????????????????????????????????????????
?????????????????????? SQL ???
delete from twhere rowid not in (select min(rowid) from t group by null);
????????????? rowid ?????????????????????????????????????????
????????????????????????????????????
-- ???????insert into t_back (select distinct mobile from t)-- ????drop table t-- ?????????rename t_back to t;
?????????????????????????????????????????????????????
???????????????????????? SQL ???
-- ???1???2????????select field1, field2, count(*) from tgroup by field1, field2having count(*) > 1where field3 = 'value';-- ????1???2?????delete from t awhere (select field1, field2 from t_b group by field1, field2 having count(*) > 1)
????????????????????????????
-- ???????????create table t_temp as(select field1, field2, max(rowid) as dataid from tgroup by field1, field2);-- ????1???2?????delete from t awhere (select field1, field2 from t_temp);
???????rowid????????????????
-- ???? `rowid`select max(b.rowid) from t bwhere a.field1 = b.field1 and a.field2 = b.field2;-- ?? `rowid` ?????????delete from t awhere a.rowid != (select max(b.rowid) from t bwhere a.field1 = b.field1 and a.field2 = b.field2);
???????????????????????
-- ????????????insert into t_back (select * from t);-- ????drop table t;-- ??????create table t as select * from t_back;
?????????????????? SQL ???
-- ??????delete from twhere column_name is null;
???????????????????
-- ??????delete from t awhere a.rowid in (select rowid from t_b group by null order by rowid);
?????????????????
-- ?????? `rowid` ???create table t_optimized as(select a.rowid, a.* from t agroup by a.rowid);-- ????drop table t;-- ?????????rename t_optimized to t;
????????????????????????
-- ?????????insert into t_new (select * from t);-- ????drop table t;-- ?????????rename t_new to t;
?????????????????? Oracle ??????????????????????????????????
转载地址:http://fxpfk.baihongyu.com/