How to find the duplicate rows in oracle?
SELECT a.deptno,a.empno,a.sal from emp a,emp b
where a.deptno=b.deptno
and a.empno=b.deptno
and a.sal=b.sal
and a.rowid<>b.rowid;
Below query is used to delete the duplicate rows from the table
Note := we should give the all the column names in groupby clause ..else only duplicate columns gets deleted
DELETE FROM emp
WHERE rowid not in
(SELECT MIN(rowid)
FROM emp
GROUP BY empno, ENAME, JOB);
How to find the duplicate coloumns in oracle?
select empno from emp group by empno having count(*)>1;
SELECT a.deptno,a.empno,a.sal from emp a,emp b
where a.deptno=b.deptno
and a.empno=b.deptno
and a.sal=b.sal
and a.rowid<>b.rowid;
Below query is used to delete the duplicate rows from the table
Note := we should give the all the column names in groupby clause ..else only duplicate columns gets deleted
DELETE FROM emp
WHERE rowid not in
(SELECT MIN(rowid)
FROM emp
GROUP BY empno, ENAME, JOB);
How to find the duplicate coloumns in oracle?
select empno from emp group by empno having count(*)>1;
No comments:
Post a Comment