Write a query to delete duplicate records in SQL SERVER
Answer Posted / sonia
Create table info(comp_id int identity(101,1),comp_name
varchar(50))
insert into info values('Progressive Ltd.')
insert into info values('Progressive Ltd.')
insert into info values('EliResearch')
insert into info values('Patni')
insert into info values('Accenture')
insert into info values('Accenture')
select * from info
DELETE FROM info
WHERE comp_name IN
(SELECT comp_name FROM info
GROUP BY comp_name HAVING COUNT(comp_name) > 1)
Is This Answer Correct ? | 12 Yes | 38 No |
Post New Answer View All Answers
What does set rowcount do?
What is the maximum number of instances in 32 bit and 64 bit sql server 2012?
Explain filtered indexes benefits?
What are the different types of backups that exist?
You want to implement the one-to-many relationship while designing tables. How would you do it?
Which is better statement or preparedstatement?
What are different types of roles provided by ssrs?
Is truncate autocommit?
Explain the phases a transaction has to undergo?
How can I add Reporting Services reports to my application?
What does it mean to invest in the index?
What is the difference between a stored procedure and a user defined function?
What are temporal tables in sql server 2016?
Difference between DELETE and TRUNCATE?
Different types of keys in SQL?