I am creating an SQL script that will add specific entries to the DB when run on a new environment. But I want to have to INSERT query insure that the data doesn't already exist before trying to insert it.
The query I came up with looks sound to me. But for some reason it gives me a syntax error. And yes I have RTFM'ed it. And I have Googled it. Based on other examples that I have seen (even here on Stack Exchange) it looks right to me. Can anyone identify what I am doing wrong?
Query:
INSERT INTO my_model (status, name) VALUES ('active', 'bbc')
WHERE NOT EXISTS (SELECT name FROM my_model WHERE name = 'bbc')
Any ideas?