Created
March 27, 2014 01:52
-
-
Save tbuckel/9798327 to your computer and use it in GitHub Desktop.
SQL Insert only of not exists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO example_table | |
(id, name) | |
SELECT 1, 'John' | |
WHERE | |
NOT EXISTS ( | |
SELECT id FROM example_table WHERE id = 1 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment