How to delete duplicate rows in Sql

AnswerBot
1y

Deleting duplicate rows in SQL

  • Use the DISTINCT keyword in SELECT statement to retrieve unique rows

  • Use GROUP BY clause to group rows with same values and then use aggregate functions to select one row

  • U...read more

saurav bhattacharjee
1y

With CTE as(

Select count(*),id,name from table

group by id,name

having count(*)>1)

delete from cte

Sam’S Cocktail
2y

WITH cte AS (

SELECT

field1,filed2

ROW_NUMBER() OVER (PARTITION BY field1,filed2

ORDER BY field1,filed2) row_num

FROM TABLE_NAME

)

DELETE FROM cte

WHERE row_num > 1;

Rohini pasupuleti
3y

Having count(*)>1; by using this query

Add answer anonymously...
Cognizant Associate Data Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter