Take the 2-minute tour ×  I have a database table containing a
'key' field which holds a system generated key.  | id | key
| etc. |  1 | osi32i4kjwlqe       | |  2 | klwjeklj1343k       |
|  3 | dfk32ld32ll23       | |  4 | lk3jkl3j42lk4       |  In
addition, I have a list of keys:   Note, that some of the keys
on the list exist in the database, and others do not.  I would
like, if I can, to run an efficient query that will go through
the list, and affirm the existence of the key in the database.
ie: if the key exists, do nothing. if it doesn't, insert a fresh
row with this key.  Does anybody know of an efficient way to do
it?  Thank you.  share|improve this question add comment  1
Answer  up vote 5 down vote accepted  I assume that your key
column is declared with UNIQUE. If so, just loop and use   for
each of your keys from JSON array. If not, well, make so as I
think this is what you want to accomplish anyway :)
share|improve this answer It should be added the above assumes
there's a uniq