write a query to delete similar records in same table

Answer Posted / santosh kumar

simple answer for deleting duplicate record from a table.....
table:---
create table t1 (id number(5),name varchar2(20));

then:----
insert into t1 values(10,'a');
insert into t1 values(10,'a');
insert into t1 values(20,'b');
insert into t1 values(20,'b');
---after insertion it'll like this----
id name
10 a
10 a
20 b
20 b

-------------------------------------------------------------
delete from t1
where rowid not in (select min(rowid) from t1 group by name);

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is pls_integer in pl sql?

753


What is partition in sql query?

719


How to start oracle sql developer?

753


what are the authentication modes in sql server? How can it be changed? : Sql dba

956


what are myisam tables? : Sql dba

721






What is coalesce in sql?

732


what is the use of double ampersand (&&) in sql queries?

820


What is data abstraction in sql?

722


Is sql a programming?

716


what are the differences between public, private, protected, static, transient, final and volatile? : Sql dba

737


How do you declare a variable in pl sql?

745


How do I trace sql profiler?

706


When do we use triggers?

800


Can we commit in trigger?

701


What is the purpose of the partition table?

754