How to delete duplicate rows in sql | How to delete duplicate records from a table in SQL
Table :
CREATE TABLE [dbo].[Emp](
[ID] [int] NULL,
[FirstName] [nvarchar](50) NULL,
[LastName] [nvarchar](50) NULL,
[Gender] [nvarchar](50) NULL,
[Salary] [int] NULL
)
Query to delete the duplicate records :
WITH EmpCTE AS
(
SELECT *, ROW_NUMBER()OVER(PARTITION BY ID ORDER BY ID) AS RowNumber
FROM EMP
)
DELETE FROM EmpCTE WHERE RowNumber ] 1
#SQLInterviewQuestionsandanswers #sqlInterviewQuestions #sqlInterviewQuestionsForTesting #sqlInterviewQuestionsQuery #sqlInterviewQuestionsOnJoins #sqlTechnicalInterviewQuestions #SQLforETLTesters #CommonSqlInterviewQuestions #ETLTesting
#DeleteDuplicateRecordsFromTable
Watch video How to delete duplicate rows in sql | How to delete duplicate records from a table in SQL online without registration, duration hours minute second in high quality. This video was added by user ALLCPL 26 March 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 157 once and liked it 3 people.