How to remove duplicate rows from a table?.

Answers were Sorted based on User's Feedback



How to remove duplicate rows from a table?...

Answer / vamsi

for example our emp table have duplicate rows than we can
run this query to delete those duplicate rows

Delete from emp a
where rowid <> ( select max(rowid) from emp where empno =
a.empno);

Is This Answer Correct ?    13 Yes 4 No

How to remove duplicate rows from a table?...

Answer / lova raju allumalla

delete from emp where rowid not in (select min(rowid) from
emp group by empno);

Is This Answer Correct ?    7 Yes 2 No

How to remove duplicate rows from a table?...

Answer / karthik

with [dup_cte] as {
select row_number(partition by eid order by eid) as rn from emp}
go
delete from [dup_cte] where rn>1

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

What is cursor in pl sql?

0 Answers  


how is myisam table stored? : Sql dba

0 Answers  


what is Hash join?how it is different from inner join?what is the sign used for inner join?(eg: like the (+) sign used for outer join)?

3 Answers   TCS,


explain the delete statements in sql

0 Answers  


What are the different types of triggers?

0 Answers  


can we delete the trigger in a view? if yes why if not why?

5 Answers   Tech Mahindra,


What is the fastest way of accessing a row in a table?

5 Answers   TCS,


What is the difference between local variables and global variables?

0 Answers  


What is synchronized subquery?

0 Answers  


one of the column in my table contains the data like SAL ---- 1000 1000 2000 3000 3000 So my requirement is i want output like SAL --- 1000 2000 3000 it mean i want to delete duplicate rows in the table permanently and i want output in the above formatow should u write query?

13 Answers   Cap Gemini, TCS,


what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba

0 Answers  


What is a record in pl/sql?

0 Answers  


Categories