write a query to delete similar records in same table

Answer Posted / umadevi

--deletes records within table without changing table name
delete from temp t1 where rowid<(select max(rowid) from temp
t2 where t1.empno=t2.empno) order by empno;

or
--create new table n insert records.
create table t1 as select distinct * from temp;

or
(truncate table)
truncate table t1;
insert into t1 select distinct * from temp;

Is This Answer Correct ?    1 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can delete statement be rollbacked?

527


What is pivot query?

596


Is it possible to create startup or shutdown trigger for on-schema?

587


What is the difference between sql and mysql?

559


How many unique keys can a table have?

558






Which command is used to delete a trigger?

777


How do I install microsoft sql?

531


What are the two characteristics of a primary key?

493


What is clause in sql?

585


Can you upgrade sql express to full sql?

520


What are the types of join in sql?

520


What are %type and %rowtype for?

619


How do I view tables in mysql?

543


How to start oracle sql developer?

558


What is 19 null in sql?

535