I read about the MySQL command ON DUPLICATE KEY UPDATE. I have a column Surnames in a Users table. Since there must be no identical surnames, I want to INSERT a new surname when the surname isn’t in the database, and leave the row as it was recorded if the surname was previously saved in the database, without updating it. How can I achieve this?
I read about the MySQL command ON DUPLICATE KEY UPDATE . I have a
Share
INSERT IGNORE ...will try to insert a new row, if a duplicate key is found the new data will be discarded.Documentation of
INSERT