Delete duplicate rows from a table without primary key by
using a single query
Table Employee
empname salary
A 200
B 300
A 200
C 400
D 500
D 500
Output should be
A 200
B 300
C 400
D 500
Answer Posted / gaurav sharma
SELECT DISTINCT * INTO Employee1 FROM Employee
DROP Table Employee
sp_rename 'Employee1','Employee'
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
How do I find the sql server instance name?
What is change data capture (cdc) in sql server 2008?
What extended events?
What is raid, and how it can influence database performance?
Why should one not prefix user stored procedures with ‘sp_’?
What is the difference between web edition and business edition?
When to use Inner join & when to use subquery?
Relational calculus is what type of language?
What is truncate table?
How to optimize stored procedure optimization?
Does partitioning help performance?
What is equi join with example?
You have several tables, and they are joined together for querying. The tables contain both clustered indexes and non clustered indexes to optimize performance, how should you distribute the tables and their indexes onto different file groups?
What are different types of collation sensitivity?
Which rendering formats are affected by the pagesize properties?