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

Code Example 1

IF NOT EXISTS (SELECT * FROM EmailsRecebidos 
                   WHERE De = @_DE
                   AND Assunto = @_ASSUNTO
                   AND Data = @_DATA)
   BEGIN
       INSERT INTO EmailsRecebidos (De, Assunto, Data)
       VALUES (@_DE, @_ASSUNTO, @_DATA)
   END

Learn ReactJs, React Native from akashmittal.com