Skip to main content

The article describes how to find duplicate records in a table with SQL. 

General syntax for the SQL query for finding duplicated rows in a table is:

SELECT [field_name], COUNT([field_name])
FROM [table_name]
GROUP BY [field_name]
HAVING (COUNT([field_name]) > 1)

For example, if we want to find duplicate records with SQL in Students table based on a student's name we could use:

SELECT Name, COUNT(Name)
FROM Students
GROUP BY Name
HAVING (COUNT(Name) > 1)

- Advertisement -
- Advertisement -