Duplicate Values:
We can find out Duplicate values using below queries.
SELECT Name , COUNT(*) TotalCount
FROM sah
GROUP BY Name
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
--find duplicate and delete
;with cte as (
select *,ROW_NUMBER()over(partition by name order by name)Rn from sah
)
select * from cte where Rn >1
-- Delete duplicate
;with cte as (
select *,ROW_NUMBER()over(partition by name order by name)Rn from sah
)
delete from cte where Rn >1