How to delete duplicate rows in sql?

Satish Kumar
Satish Kumar

Posted On: Apr 08, 2020


The duplicate rows in the SQL can be deleted in the following manner.

  • The duplicate rows need to be found using the ROW_NUMBER function or GROUP by clause
  • DELETE statement is then used to erase the duplicate rows in the SQL.

Duplicate rows can also be deleted from the SQL by using CTE (Common Table Expression), T-SQL and SSIS package.

Syntax to delete duplicate rows in SQL

SELECT DISTINCT column1, column2,....columnN  
FROM table _name  
WHERE [conditions]  

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Cognizant Cognos Interview Questions

    How to test reports in Cognos?

    The reports can be tested in Cognos Viewer in the following wayConnect to the Cognos BI portal and start the Cognos connection. Click the Cognos content inside the welcome page In the Cognos adm...

    Cognizant Cognos Interview Questions

    Can we apply grouping on crosstab?

    Yes, we can. Two crosstabs can be grouped as they behave and look as one crosstab. Grouping crosstabs move closer together without any space between them. The row axis builds the common axis of the cr...

    Cognizant Cognos Interview Questions

    List types of report available in cagonos?

    There are various types of reports that are available in Cognos. A few of them are as follows:List Reports: List reports are implied to display the entire base of the customer. Charts: Charts are...