Oracle Archives - Tech Insights https://reactconf.org/category/delete-duplicate-records-from-oracle-table/ Unveiling Tomorrow's Tech Today, Where Innovation Meets Insight Mon, 03 Jun 2013 06:33:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 https://i0.wp.com/reactconf.org/wp-content/uploads/2023/11/cropped-reactconf.png?fit=32%2C32&ssl=1 Oracle Archives - Tech Insights https://reactconf.org/category/delete-duplicate-records-from-oracle-table/ 32 32 230003556 Delete duplicate records from oracle table https://reactconf.org/deleteduplicaterecord/ https://reactconf.org/deleteduplicaterecord/#respond Mon, 03 Jun 2013 06:33:00 +0000 http://www.sqlneed.com/2013/06/03/delete-duplicate-records-from-oracle-table/ Delete duplicate records from oracle table Note: please before executing this query take data backup. Example I: Delete from employees where rowid in (select rowid from (select first_name, last_name, rowid, …

The post Delete duplicate records from oracle table appeared first on Tech Insights.

]]>
Delete duplicate records from oracle table


Note: please before executing this query take data backup.

Example I:
Delete from employees
where rowid in
(select rowid
from
(select first_name, last_name, rowid,
row_number() over
(partition by first_name, last_name order by employee_id)
stf_row
from  employees)
where stf_row > 1);


Example  II :

Delete FROM
   Employees A
WHERE
  a.rowid >
   ANY (
     SELECT
        B.rowid
     FROM
        Employees B
     WHERE
        A.First_name = B.First_Name
     AND
        A.last_name = B.Last_Name
        );


 Example  III :

 Delete from
  Employees A
  Where rowid <> (
            SELECT
             Max(rowid)
            From
            Employees B
            Where
            B.First_Name = A.First_Name
            AND
            B.Last_Name = A.Last_Name )

Result



The post Delete duplicate records from oracle table appeared first on Tech Insights.

]]>
https://reactconf.org/deleteduplicaterecord/feed/ 0 2225