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 is difference between group by and having?
What is database black box testing?
How do you use a subquery to find records that exist in one table and do not exist in another?
What is a constant or literal in ms sql server?
How will you make an attribute not process? : sql server analysis services, ssas
List the different types of collation sensitivities in sql server?
What are the differences between ms sql server & oracle?
How to delete an existing database user?
What is the difference between deallocate cursor and close cursor?
What is de-normalization and what are some of the examples of it?
What is user-defined function?
What is multilevel indexing?
How many types of the database links?
What do you mean by cardinality?
What is the difference between a function and a trigger?