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
Is it possible to have clustered index on separate drive from original table location?
Does view occupy space?
Can we do dml on views?
What is temporary table in sql server? Why we use temp table?
Where can you add custom error messages to sql server?
what is spatial nonclustered index
explain different types of backups avaialabe in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration
What are the pros and cons of putting a scalar function in a queries select list or in the where clause?
What is the difference between for xml raw and for xml auto?
Equi join and non equi join is possible with sql server?
Why use identity in sql server?
Why we use the openxml clause?
Explain system functions or built-in functions? What are different types of system functions?
How to enter binary string literals in ms sql server?
What are the different subsets of sql?