How to delete duplicate records from a table?(for suppose in
a table we have 1000 Records in that we have 200 duplicate
Records , so ,how to findout that duplicate Records , how to
delete those Records and arranged into sequence order? one
more thing that there is no primary key at all)
Answer Posted / pooja narang
We will get the duplicate records and insert them into a
new temp table by using below query:
select * into tmp_Employee
from Employee
having count(distinct *) > 1
Now delete the duplicate records from Employee table:
delete from Employee
having count(distinct *) > 1
Now insert the records from tmp_Employee to Employee table:
insert into Employee
select * from tmp_employee
drop table tmp_employee
| Is This Answer Correct ? | 4 Yes | 15 No |
Post New Answer View All Answers
What are the disadvantages of primary key and foreign key in SQL?
Why do we use non clustered index?
How many types of dimensions are there and what are they? : sql server analysis services, ssas
What do you mean by stored techniques? How would we use it?
How column data types are determined in a view?
List the types of recovery model available in sql server?
How to rebuild indexes with alter index ... Rebuild?
How to create new tables with "create table" statements in ms sql server?
What are the types of indexes?
What do you need to connect php to sql server?
Does partitioning help performance?
What does it mean to be in union?
What does the on update no action do?
What is purpose of normalization?
What is indexing in sql server with example?