Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

insert if not exists postgresql

INSERT INTO example_table (id, name)
SELECT 1, 'John'
WHERE
    NOT EXISTS (
        SELECT id FROM example_table WHERE id = 1
    );
 
PREVIOUS NEXT
Tagged: #insert #exists #postgresql
ADD COMMENT
Topic
Name
2+9 =