zoukankan      html  css  js  c++  java
  • Remove Duplicate Rows from Oracle Database Table

    If you need to remove duplicate rows from an Oracle Database Table, you can use different approaches. For example, you can use the DELETE command with a criteria that selects only duplicates. Usually it is faster to create a new table with distinct rows and replace the old table with the new one.

    -- Create a new table with distinct row values.
    CREATE TABLE temp_table_name AS
       SELECT DISTINCT * 
          FROM source_table_name;
     
    -- Replace the original table with the new table.
    DROP TABLE source_table_name;
    RENAME temp_table_name TO source_table_name;

    Of course in real life the are always complications. For example, the above example doesn’t take in account constraints and indexes. You should carefully investigate all dependencies to avoid performance degradation and to preserve data integrity.

  • 相关阅读:
    二维数组和最大字数组求取 2
    spring冲刺第七天
    spring冲刺第六天
    寻找水王
    spring冲刺第五天
    spring冲刺第四天
    spring冲刺第三天
    spring冲刺第二天
    大道至简读书笔记3
    spring冲刺第一天
  • 原文地址:https://www.cnblogs.com/simonhaninmelbourne/p/2872443.html
Copyright © 2011-2022 走看看