Oracle Scenarios Question:

Download Job Interview Questions and Answers PDF

How we remove duplicate rows in table?

Oracle Scenarios Interview Question
Oracle Scenarios Interview Question

Answers:

Answer #1
select * from employee a where rowid not in(Select min(rowid) from employee b where b.emp_id = a.emp_id)

Answer #2
delete from emp where rowid not in (select max(rowid) from emp group by empid )

Answer #3
select * from employee a where rowid in (select min(rowid) from employee b where a.emp_id=b.emp_id)

Answer #4
select count(*), all_columns from table_name group by all_columns having count(*) > 1;

Answer #5
DELETE FROM TABLENAME WHERE ROWID NOT IN (SELECT MAX(ROWID) FROM TABLENAME GROUP BY DUPLICATECOLUMNNAME);

Answer #6
DELETE FROM EMP
WHERE ROWID NOT IN
(SELECT MIN(ROWID) FROM EMP
GROUP BY EMPNO);

Download Oracle Scenarios Interview Questions And Answers PDF

Previous QuestionNext Question
Explain about the oracle disaster recovery scenarios?How to append data in a file from one server to another server?