Duplicate Key Question

INSERT INTO users
   SET (login, email) 
   VALUES ('test_user', 'nothing@nothing.com')

ON DUPLICATE KEY UPDATE
   email = 'something_else@nothing.com'

Is DUPLICATE KEY comparing the tables PRIMARY KEY?

So if I have an auto_incremented PRIMARY KEY, this would be useless, true?

Here ya go :smiley:

Hey thanks I will read about this better, the Unique Indeices.

It’s comparing for primary key and/or unique indices.
So if the username has a unique index for example it would work as well.
If you just have an auto_increment PK, then no, it won’t work.