Check out example codes for "sqlite insert if not exists". It will help you in understanding the concepts better.

Code Example 1

#id column is assumed to be primary key

INSERT INTO destination_table(id,name) 
SELECT id, name
FROM source_table s
WHERE NOT EXISTS (
  SELECT 1
  FROM destination_table d
  WHERE d.id = s.id
);

Learn ReactJs, React Native from akashmittal.com