Forum

How to Delete Dupli...
 
Share:
Notifications
Clear all

How to Delete Duplicate Records From Country Table?


Posts: 47
Guest
Topic starter
(@Rakesh)
Eminent Member
Joined: 4 years ago

Can you please help me to write a query to Delete Duplicate Records From Country Table?

3 Replies
Posts: 27
Admin
(@vinodkrsetty)
Eminent Member
Joined: 5 years ago

Check this article https://www.sqlqueries.in/how-to-delete-duplicate-rows-from-a-table/   to know how to delete duplicate records in a table. 

Reply

Self Learning Video Tutorials - Software Course

Posts: 36
Guest
(@Janani T)
Eminent Member
Joined: 4 years ago

Let us take 3 columns ID, Name and Code from the country table. You can write a query something like.

Select   ID, Name, Code, Count(*) as CNT
 
          From Country
 Group By ID, Name, Code
 Having Count(*)=1
 
Reply
Posts: 47
Guest
Topic starter
(@Info User 1)
Eminent Member
Joined: 4 years ago

With CTE as

(

Select Gender, Salary, row_number() over ( order by Gender ) as rownum

From employees

)

Delete from employees where rownum>1;

Reply

Self Learning Video Tutorials - Software Course

Leave a reply

Author Name

Author Email

Title *

 
Preview 0 Revisions Saved
Share: