While building my application with relational tables I went in to the following problem :

I've the next table, let's imagine named "valores":

| id  |     value     |
|  1  |  Unique VAL   |
|  2  |  Unique VAL2  |

What I am attempting to do is place the a brand new value whether it does not exist already, the way in which I am doing the work at this time is:

INSERT IGNORE INTO valores (id, value) VALUES (NULL, "Unique VAL2");

Therefore it will not do anything whatsoever. Since the value already is available.. now my real question is:

┬┐Is this the very best and also the quickest method of doing it?

I believe this is actually the easiest way for the scenario.

For various reasons you could utilize ON DUPLICATE KEY UPDATE or REPLACE INTO

Find out more: insert, replace, on duplicate.