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 are all the common sql function? : Sql dba
What is %type in pl sql?
what is the command line end user interface - mysql? : Sql dba
What are different types of queries in sql?
how tsql statements can be written and submitted to the database engine? : Transact sql
Can we use ddl statements in stored procedure?
What is trigger in sql? Explain
list out some tools through which we can draw e-r diagrams for mysql. : Sql dba
What is the use of procedures?
Can we create clustered index without primary key?
What is sql not null constraint?
explain advantages of myisam over innodb? : Sql dba
How do I view a sql database?
How do you update a value in sql?
Can you join a table to itself?