I am trying to insert a data into SQLite database using Python.
INSERT INTO DATA_TABLE(UID,LABEL) VALUES (NULL, "UK")
WHERE "UK" NOT EXISTS IN (SELECT LABEL FROM DATA_TABLE);
This query is dynamically generated from Python and I am checking whether the date is already exist in the table before inserting and its not working in SQLite database.
Getting this near "WHERE": syntax error
error.
Am I doing something wrong ?
Thanks for your help.
I'm pretty sure that INSERT
doesn't have a WHERE
clause (the documentation doesn't mention any). What you can do:
LABEL
INSERT OR FAIL