mysql on duplicate key specify key 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
INSERT INTO t1 (a,b,c) VALUES (1,2,3)
ON DUPLICATE KEY UPDATE c=3;
INSERT INTO t1 (a,b,c) VALUES (4,5,6)
ON DUPLICATE KEY UPDATE c=9;