use of duplicate key in mysql code example
Example 1: find duplicate keys in mysql
SELECT col, COUNT(col) FROM table_name GROUP BY col HAVING COUNT(col) > 1;
Example 2: mysql on duplicate key update
UPDATE t1 SET c=c+1 WHERE a=1 OR b=2 LIMIT 1;
SELECT col, COUNT(col) FROM table_name GROUP BY col HAVING COUNT(col) > 1;
UPDATE t1 SET c=c+1 WHERE a=1 OR b=2 LIMIT 1;