我的数据库里面有10000条记录,没有序列列号我现在想知道我的5000-7000条记录于7000-10000之间有没有重复的数据
请问一下怎么设计?加一个序列号么? 怎么加。我看好多都是定义一个序列号,可是我已经插入到表里面过了

解决方案 »

  1.   

    判断重复:
    select count(1) from table a where rownum between 5000 and 7000
    and exists (
    select 1 from table b where rownum between 7000 and 10000
    and a.c1=b.c1
    )
    插入序列:
    update table set c_seq=rownum
    然后加入序列,从max(c_seq)+1 开始
      

  2.   

    搞定了
    select * from xyw a where exists (select 1 from xyw  where yhm=a.yhm group by yhm having count(*)>1) order by yhm 
    散分