How to remove duplicate rows from a table?.
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
What is cursor in pl sql?
how is myisam table stored? : Sql dba
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)?
explain the delete statements in sql
What are the different types of triggers?
can we delete the trigger in a view? if yes why if not why?
What is the fastest way of accessing a row in a table?
What is the difference between local variables and global variables?
What is synchronized subquery?
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?
what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba
What is a record in pl/sql?