How to find duplicate records in mysql
IF you want to find duplicate records in a table, you can use the following query
In this query we use Count() function , Group By and Having clause
SELECT
Column_name,
COUNT(Column_name)
FROM
table_name
GROUP BY Column_name
HAVING COUNT(Column_name) > 1;
![mysql My info adda](https://myinfoadda.com/wp-content/uploads/2020/06/Screenshot.png)
For example in my case in my USER table, I want to check how many duplicates names so I wright query
SELECT
firstname,
COUNT(firstname)
FROM
user
GROUP BY firstname
HAVING COUNT(firstname) > 1;
![my info adda How to find duplicate records in mysql](https://myinfoadda.com/wp-content/uploads/2020/06/Screenshot-1.png)