SELECT varchar_col
FROM table
GROUP BY varchar_col
HAVING COUNT(*) > 1;
SELECT
t1.primary_id,
t1.duplicate_id,
t1.data1,
t1.data2
FROM
table_name t1
LEFT JOIN table_name t2
ON (t1.duplicate_id = t2.duplicate_id AND t1.primary_id < t2.primary_id)
WHERE
t2.primary_id IS NULL
SELECT name, COUNT(*) c FROM table GROUP BY name HAVING c > 1;
SELECT firstname,
lastname,
list.address
FROM list
INNER JOIN (SELECT address
FROM list
GROUP BY address
HAVING COUNT(id) > 1) dup
ON list.address = dup.address;
select t.*
from table t
where exists (select 1 from table t2 where t2.url = t.url and t2.id <> t.id);
# Duplicate rows or row
INSERT INTO table (col1, col2, col3)
SELECT col1, col2, col3 FROM table
WHERE something...;