Check out example codes for "mysql on duplicate key ignore". It will help you in understanding the concepts better.

Code Example 1

INSERT INTO table_tags (tag) VALUES ('tag_a'),('tab_b'),('tag_c') ON DUPLICATE KEY UPDATE tag=tag;

Learn ReactJs, React Native from akashmittal.com