易截截图软件、单文件、免安装、纯绿色、仅160KB

Oracle删除表中重复记录

--刪除重復列  
  a.如果有ID字段,就是具有唯一性的字段  
   
  delect   table   where   id   not   in   (  
   
  select   max(id)   from   table   group   by   col1,col2,col3...  
  )  
  group   by   子句后跟的字段就是你用到判斷重复的字段  
   
   
   
  b.,如果是判斷所有字段  
  select   *   into   #aa   from   table   group   by   id1,id2,....  
  delete   table   table    
  insert   into   table    
  select   *   from   #aa  
   
   
   
  c.如果表中有ID的情況  
   
  select   identity(int,1,1)   as   id,*   into   #temp   from   tabel  
  delect   #   where   id   not   in   (  
  select   max(id)   from   #   group   by   col1,col2,col3...)  
  delect   table  
  inset   into   table(...)  
  select   .....   from   #temp  
   
   
  col1+','+col2+','...col5   組合主鍵  
   
   
  select   *   from   table   where   col1+','+col2+','...col5   in   (  
   
  select   max(col1+','+col2+','...col5)   from   table    
  where   having   count(*)>1  
  group   by   col1,col2,col3,col4    
  )  
  group   by   子句后跟的字段就是你用到判斷重复的字段  
   
  d.  
 


相关文档:

oracle 数据库改oracle_sid的操作方法

修 改 SID
案例: 旧数据库(OLDDB)
        文件存放(data files,redo files,control files,temp files, undo files)目录是
(/u01/OLDDB)
dump文件目录是(/u01/dump)
       新数据库(NEWDB)
   ......

oracle数据库如何清理临时表空间

     正常来说,在完成Select语句、create index等一些使用TEMP表空间的排序操作后,Oracle是会自动释放掉临时段a的。但有些有侯我们则会遇到临时段没有被释放,TEMP表空间几乎满的状况,甚至是我们重启了数据库仍没有解决问题。这个问题在论坛中也常被网友问到,下面我总结一下,给出几种处理方法。 ......

Oracle中TO_DATE格式

TO_DATE格式(以时间:2007-11-02   13:45:25为例)
   
        Year:      
        yy two digits 两位年            &n ......

ORACLE标签收藏

@@servername:返回运行SQL Server数据库本地服务器的名称。
@@remserver:返回登录记录中记载的远程SQL Server服务器的名称。
@@connections:返回自上次启动SQL Server以来连接或试图连接的次数,用其可让管理人员方便地了解今天所有试图连接服务器的次数。
@@cursor_rows:返回最后连接上并打开的游标中当前存在的合格 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号