Header Ads

Header ADS

Find out Duplicate Rows in Oracle

Find out Duplicate Rows in Oracle

Topic Introduction: In this tutorial, we will show how to find out duplicate rows in Oracle.


Method #1

  SELECT LAST_NAME, COUNT (LAST_NAME) "Employee Count"
    FROM employees
GROUP BY LAST_NAME
  HAVING COUNT (LAST_NAME) > 1;

Method #2

SELECT LAST_NAME, rn
  FROM (SELECT LAST_NAME,
               ROW_NUMBER () OVER (PARTITION BY LAST_NAME ORDER BY ROWID) rn
          FROM employees)
 WHERE rn > 1;





No comments

Theme images by Deejpilot. Powered by Blogger.