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
What is the difference between explicit and implicit cursors in oracle?
What is left join in postgresql?
What is the use of procedures?
What does cursor do in sql?
What are the benefits of stored procedures?
how can I make a script that can be bi-language (supports english, german)? : Sql dba
What is memory optimized table?
What is integrity in sql?
how do you login to mysql using unix shell? : Sql dba
Write a sql query to find the names of employees that begin with ‘a’?
how to enter binary numbers in sql statements? : Sql dba
How can you view the errors encountered in a trigger?
Can ddl statements be used in pl/sql?
How is data stored on a disk?
What is consistency?