Jul 28, 2020 3:59 am
Can you please help me to write a query to Delete Duplicate Records From Country Table?
3 Replies
Jul 28, 2020 11:09 am
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.
Jul 29, 2020 7:15 am
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
Aug 07, 2020 11:12 am
With CTE as
(
Select Gender, Salary, row_number() over ( order by Gender ) as rownum
From employees
)
Delete from employees where rownum>1;